Skip to content

Instantly share code, notes, and snippets.

@Zantier
Zantier / cmd-colors.reg
Last active April 11, 2024 09:08
Registry file: Add WSL Ubuntu Bash to the context menu of folders in File Explorer.
Windows Registry Editor Version 5.00
; Delete directories under HKEY_CURRENT_USER\Console, then run this
; Examples: https://gist.github.com/P4/4245793
[HKEY_CURRENT_USER\Console]
"WindowAlpha"=dword:000000cd
"DefaultBackground"=dword:00000000
; black dgray
"ColorTable00"=dword:00141414
@Zantier
Zantier / index.js
Last active July 4, 2019 16:25
javascript async/await vs Promise
// Both these pieces of code produce the same output, but the async method is neater, because
// all the variables stay in scope, and we can use a return statement to end the execution
// at any point.
// Here is the output in both cases:
// f has been called with param 2
// ...
// The quotient is 5
// f has been called with param -1
// Dividing by 1 is not interesting
@Zantier
Zantier / thread_example.py
Last active February 6, 2020 15:59
python: Create thread by function or class
from threading import Thread
import time
class Timer(Thread):
def __init__(self, func, time):
super().__init__()
self.func = func
self.time = time
def run(self):