Skip to content

Instantly share code, notes, and snippets.

Bill Mill llimllib

Block or report user

Report or block llimllib

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View _names.py
from csv import DictReader
from random import choice, random, randint
firstnames = []
lastnames = []
for line in DictReader(open("names.csv")):
name = line["name"].split("(")[0].strip(" +")
first, last = name.rsplit(" ", 1)
firstnames.append(first)
lastnames.append(last)
@llimllib
llimllib / mssql_to_csv.bash
Last active Mar 12, 2020
This is a script to convert every table in a Microsoft SQL Server database backup (.bak file) to a .csv file
View mssql_to_csv.bash
#!/usr/bin/env bash
# import an MS SQL .bak backup file to an MS SQL database, then export all
# tables to csv. run this script as `import.sh <filename>`. It expects to be
# run in the same directory as the backup file.
# this is only tested on my mac (OS X Catalina). I tried to stick to posix, but
# It will probably require some tweaking for you. I hope it gives a general
# sense of what you need to do at the very least.
View install.sh
#!/usr/bin/env bash
# many settings from https://raw.githubusercontent.com/mathiasbynens/dotfiles/master/.macos
# many settings from https://raw.githubusercontent.com/thoughtbot/laptop/master/mac
# previous install notes at:
# https://gist.github.com/llimllib/ee591266e05bd880629a4e7511a61bb3
# https://gist.github.com/llimllib/e864a92da94ceb1ef0da2e06fd1f8d70
fancy_echo() {
local fmt="$1"; shift
View RTP_paper.csv
We can't make this file beautiful and searchable because it's too large.
StartDate,EndDate,Progress,BirthYear,Sex,Country,Country3,CompleteMarathons,YearsExp,TargetPace,FastPace,TrainDist,WeeksTrain,LongTrainRuns,LastTimeHrs,LastTimeMins,LastTimeSecs,FirstHalfHrs,FirstHalfMins,FirstHalfSecs,Ambition1,Ambition2,Ambition3,Ambition4,Ambition5,Dospert1,Dospert2,Dospert3,Dospert4,Dospert5,Dospert6,Dospert7,Dospert8,Dospert9,Dospert10,Dospert11,Dospert12,Suffer1,Suffer2,Suffer3,Suffer4,Suffer5,Suffer6,Suffer7,Suffer8,Goal1,Goal2,Goal3,Comp1,Comp2,Comp3,LastTime,FirstHalfTime,SecondHalfTime,Pace1,AmbitionTotal,AmbitionTotal3,DospertTotal,SufferTotal,SufferTotal16,CompetitionTotal,GoalTotal,TargetPaceQ,FastPaceQ,TrainDistQ,WeeksTrainQ,LongTrainRunsQ,CompleteMarathonsQ,YearsExpQ,LastTimeadj,Age
4/19/16 21:49,4/19/16 21:50,100,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,30,NA,NA,30,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
4/19/16 21:50,4/19/16 22:04,100,1972,Male,United States of Ameri
View memory_graph.sh
#!/usr/bin/env bash
set -x
GODEBUG=gctrace=1 etl -data_dir=etl/data -skip_aws &
ETL_PID=$!
function finish {
kill -9 $ETL_PID
}
trap finish EXIT
View running graph.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View auth.py
import base64
import os
import sys
from urllib.parse import urlencode
from webbrowser import open as open_url
import requests
SPOTIFY_OAUTH_URL = "https://accounts.spotify.com/authorize"
SPOTIFY_TOKEN_URL = "https://accounts.spotify.com/api/token"
View binary.py
def b(integral):
res = []
while integral > 0:
integral, mod = divmod(integral, 2)
res.insert(0, "1" if mod else "0")
return "".join(res)
View install
# many settings from https://raw.githubusercontent.com/mathiasbynens/dotfiles/master/.macos
# many settings from https://raw.githubusercontent.com/thoughtbot/laptop/master/mac
# my previous install notes at https://gist.github.com/llimllib/ee591266e05bd880629a4e7511a61bb3
fancy_echo() {
local fmt="$1"; shift
# shellcheck disable=SC2059
printf "\n$fmt\n" "$@"
}
View e.py
def run(cmds):
location = 0
counter = 0
while 1:
try:
cmd = cmds[location]
if cmd >= 3:
cmds[location] -= 1
else:
cmds[location] += 1
You can’t perform that action at this time.