This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def plot(keys: list, vals: list): | |
import matplotlib.pyplot as plt | |
fig = plt.figure() | |
ax = fig.add_subplot(111) | |
x = range(len(vals)) | |
ax.set_xticks(x) # plot every tick | |
ax.set_xticklabels(keys, rotation=90) | |
ax.plot(x, vals) | |
fig.savefig('output.png', bbox_inches='tight') # bbox_inches='tight' to prevent text-overflow out of the frame |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# register to pip | |
python setup.py register -r pypi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM run command by parsing ${cd} to %cd% and ${home} to %home% | |
setlocal ENABLEDELAYEDEXPANSION | |
set str=%* | |
set str=!str:${cd}=%CD%! | |
set str=!str:${home}=%HOME%! | |
REM run the parsed command | |
%str% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
sendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
#MaxHotkeysPerInterval 200 | |
; Capslock + jkli (left, down, up, right) | |
#InstallKeybdHook | |
#UseHook On |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
def force_async(fn): | |
''' | |
turns a sync function to async function using threads | |
''' | |
from concurrent.futures import ThreadPoolExecutor | |
import asyncio | |
pool = ThreadPoolExecutor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; escaper (this is used to reset all the keys) | |
~lalt up:: | |
{ | |
send {ctrl up} | |
send {lctrl up} | |
send {alt up} | |
send {lalt up} | |
return | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* returns true iff val equals every element in the list | |
*/ | |
function all(list, val) { | |
if (list.length === 0) return false | |
const first = list[0] | |
if (first !== val) return false | |
for (const elem of list) { | |
if (first !== elem) return false | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
; Tab Switching | |
+![:: | |
Send, ^+{TAB} | |
return | |
+!]:: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ | |
"key": "alt+a", | |
"command": "editor.action.selectAll" | |
}, | |
{ | |
"key": "alt+x", | |
"command": "editor.action.clipboardCutAction" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
def unzip(l): | |
return zip(*l) | |
def merge(*itrs): | |
from itertools import chain | |
return chain.from_iterable(itrs) | |
async def wait(l): |