This file contains 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 os, itertools | |
from subprocess import run | |
from multiprocessing.dummy import Pool | |
from functools import partial | |
def create_command_list(cli_program= " ", invocation=" ", script_name = " ", *args): | |
""" | |
Constructs a list of arguments to be passed to cli_program and/or script name with the invocation specified. to be passed to run_in_parallel below | |
example use: |
This file contains 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 os, itertools | |
from subprocess import run | |
from multiprocessing.dummy import Pool | |
from functools import partial | |
def set_globs(stexec,scname): | |
global script_name, stata_exec | |
stata_exec = stexec | |
script_name = scname |
This file contains 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. | |
Capslock::Ctrl | |
RAlt::Esc |
This file contains 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 os, glob | |
def clean_folder(exts, | |
root, | |
subdir=True, | |
fn='*.'): | |
""" | |
Clears files with extension in exts matching pattern fn in directory | |
(and subdirectories if subdir is set to true) in root | |
""" | |
if subdir == True: |
This file contains 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
; ############################ AHK Greek Letters.ahk > | |
; Uses (CTRL & ALT & SHIFT & alphabetic keyboard keys) to send lowercase Greek letters to your text editor | |
+^!a::Send {U+03B1} ; α - alpha | |
+^!b::Send {U+03B2} ; β - beta | |
+^!g::Send {U+03B3} ; γ - gamma | |
+^!c::Send {U+03B3} ; γ - gamma | |
+^!d::Send {U+03B4} ; δ - delta | |
+^!e::Send {U+03B5} ; ε - epislon |
This file contains 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
// find->find in files | |
// Switch on reg_ex button | |
// Find: | |
^(.*)$ | |
// Where: | |
c:\your_folder\,*.py,*.r,*.sh,*.do,*.md, -*/folder_to_exclude/* | |
// Then click on the find button | |
// On the bottom line of your search result you'll find something like: | |
// 21342 matches in 124 files = your lines of code |
This file contains 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
youtube-dl --download-archive downloaded.txt --no-post-overwrites -ciwx --audio-format mp3 -o "%(title)s.%(ext)s" youtube_playlist_here |
This file contains 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
# command_for_r | |
# $r_exec --no-save --no-restore --verbose | |
# N:/.../script.R | |
# inp_file = 'input.dta' | |
# inp_dir - 'D:/input/' | |
# working = 'D:/working/' | |
# dep_var = 'tot_grouped_cost' | |
# rhs_vars = c('age ') | |
# cmd: 2>&1 |
This file contains 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 os | |
import re | |
os.chdir('data_directory') | |
raw_files = [x for x in os.listdir()] | |
for raw in raw_files: | |
inputfile = raw | |
outputfile = raw.split('.')[0]+'_clean.txt' |
This file contains 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
library(lfe) | |
library(stargazer) | |
set.seed(6152011) | |
# Number of cities | |
L <- 1000 | |
# Number of industries | |
K <- 3 |
OlderNewer