Skip to content

Instantly share code, notes, and snippets.

@FI-Mihej
FI-Mihej / youtube.md
Created April 24, 2023 00:50 — forked from bitsurgeon/youtube.md
Markdown cheatsheet for YouTube

Embed YouTube Video in Markdown File

  1. Markdown style
[![Watch the video](https://img.youtube.com/vi/nTQUwghvy5Q/default.jpg)](https://youtu.be/nTQUwghvy5Q)
  1. HTML style
<a href="http://www.youtube.com/watch?feature=player_embedded&v=nTQUwghvy5Q" target="_blank">
#include <windows.h>
void SetWindowBlur(HWND hWnd)
{
const HINSTANCE hModule = LoadLibrary(TEXT("user32.dll"));
if (hModule)
{
@FI-Mihej
FI-Mihej / gist:ededbd7d66ec5123427df5e2edac7a12
Created July 6, 2022 17:35 — forked from riverar/gist:fd6525579d6bbafc6e48
C# structures to implement "Aero Glass" blur on Windows 10
[DllImport("user32.dll")]
internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
[StructLayout(LayoutKind.Sequential)]
internal struct WindowCompositionAttributeData
{
public WindowCompositionAttribute Attribute;
public IntPtr Data;
public int SizeOfData;
}
@FI-Mihej
FI-Mihej / multi_uvicorn.py
Created January 18, 2022 23:00 — forked from tenuki/multi_uvicorn.py
How to run multiple uvicorn server apps in the same process (thanks @a-d-j-i )
##
## How to run multiple uvicorn server apps in the same process
##
import asyncio
from uvicorn import Server, Config
class MyServer(Server):
async def run(self, sockets=None):
self.config.setup_event_loop()
return await self.serve(sockets=sockets)
@FI-Mihej
FI-Mihej / angle_helpers.py
Created December 30, 2020 21:10 — forked from ChrisAichinger/angle_helpers.py
Functions for working with angles
import math
def average_angles(angles):
"""Average (mean) of angles
Return the average of an input sequence of angles. The result is between
``0`` and ``2 * math.pi``.
If the average is not defined (e.g. ``average_angles([0, math.pi]))``,
@FI-Mihej
FI-Mihej / python_tests_dir_structure.md
Created December 12, 2019 04:29 — forked from tasdikrahman/python_tests_dir_structure.md
Typical Directory structure for python tests

A Typical directory structure for running tests using unittest

Ref : stackoverflow

The best solution in my opinion is to use the unittest [command line interface][1] which will add the directory to the sys.path so you don't have to (done in the TestLoader class).

For example for a directory structure like this:

new_project

├── antigravity.py

@FI-Mihej
FI-Mihej / Electron_Mac_App_Store_Submission_Guide.md
Created August 18, 2019 21:19
Electron Mac App Store Submission Guide

Source

Mac App Store Submission Guide

Since v0.34.0, Electron allows submitting packaged apps to the Mac App Store (MAS). This guide provides information on: how to submit your app and the limitations of the MAS build.

Note: Submitting an app to Mac App Store requires enrolling in the [Apple Developer Program][developer-program], which costs money.

@FI-Mihej
FI-Mihej / 32.asm
Created April 16, 2019 11:28 — forked from FiloSottile/32.asm
NASM Hello World for x86 and x86_64 Intel Mac OS X (get yourself an updated nasm with brew)
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
global start
section .text
start:
push dword msg.len
push dword msg
push dword 1
mov eax, 4
@FI-Mihej
FI-Mihej / instructions
Created March 28, 2019 13:32 — forked from brenes/instructions
Repairing non-monotic index git error
> git fetch
...
error: non-monotonic index .git/objects/pack/pack-be03d54c63e1a503114461d4c1945b34c7af01c8.idx
...
> rm .git/objects/pack/pack-be03d54c63e1a503114461d4c1945b34c7af01c8.idx
> git index-pack .git/objects/pack/pack-be03d54c63e1a503114461d4c1945b34c7af01c8.pack
@FI-Mihej
FI-Mihej / nginxproxy.md
Created September 14, 2016 00:35 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers