Skip to content

Instantly share code, notes, and snippets.

View loisaidasam's full-sized avatar
🙌
🙌

Loisaida Sam loisaidasam

🙌
🙌
View GitHub Profile
@loisaidasam
loisaidasam / mktmpenv.txt
Last active December 7, 2021 07:26
TIL how to make a temporary virtualenv - thanks @hery!
$ mktmpenv
New python executable in tmp-f4732394b48189f9/bin/python
Installing setuptools............done.
Installing pip...............done.
This is a temporary environment. It will be deleted when you run 'deactivate'.
(tmp-f4732394b48189f9) sallah:~/.virtualenvs/tmp-f4732394b48189f9$ deactivate
Removing temporary environment: tmp-f4732394b48189f9
Removing tmp-f4732394b48189f9...
@loisaidasam
loisaidasam / rename_images.py
Created August 7, 2012 22:06
Rename images for use by ImageMagick convert or ffmpeg convert
# Goes a little something like this:
import os
files = [ f for f in os.listdir('.') if os.path.isfile(os.path.join('.',f)) and f.endswith('.jpg') ]
for i, file in enumerate(sorted(files)):
os.rename(file, 'image%03d.jpg' % i)
# Now with them renamed you can do something like:
@loisaidasam
loisaidasam / 0-README.md
Last active June 29, 2021 09:46
La Vuelta event-stream updates
@loisaidasam
loisaidasam / gist:2774350
Created May 23, 2012 09:59
One liner for counting unique IP addresses from nginx logs
# One liner for counting unique IP addresses from nginx logs
# Feel free to comment with better ideas - I'm sure it's not the best way of doing this (I'm no awk ninja!)
#
# Sample output:
#
# $ cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }'
# 66.65.145.220 49
# 92.63.28.68 126
cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }'
{
"exclamations": [
"Holy Agility",
"Holy Almost",
"Holy Alphabet",
"Holy Alps",
"Holy Alter Ego",
"Holy Anagram",
"Holy Apparition",
"Holy Armadillo",
@loisaidasam
loisaidasam / random_word.sh
Created August 5, 2013 14:37
Command line random word generator
#!/bin/bash
DICT="/usr/share/dict/words"
NUM_WORDS=$(wc -l $DICT | awk -F " " '{print $1}')
NUM_DIGITS=${#NUM_WORDS}
while true
do
NUM=""
@loisaidasam
loisaidasam / VOTE_ATLANTA.md
Created June 3, 2020 17:38
Atlanta Early Voting Locations
@loisaidasam
loisaidasam / story.ipynb
Created May 1, 2020 03:55
Story about numpy ndarrays with nested sequences
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@loisaidasam
loisaidasam / results.txt
Last active February 12, 2020 21:12
Python: setattr() vs. direct object manipulation
$ python test_setattr.py
test_setattr 0.11335835400000001
test_direct_object_manipulation 0.04550438199999998
$ python test_setattr_data_types.py
int
setattr() 0.104297199
direct obj manipulation 0.046985358000000005
float
setattr() 0.097025698