Skip to content

Instantly share code, notes, and snippets.

@galvanic
galvanic / translateNA.py
Created February 18, 2014 20:34
Translate a nucleic acid sequence into all 6 open reading frames
from itertools import chain, islice
"""
Improvements:
Measure how fast/good this script is. Is it space efficient ?
No point having fancy programming if it's not faster (fancy bit being the sliding window)
Maybe take into account the case of letters (if upper or lower case).
I feel like I could remove some of the repetition.
"""
@galvanic
galvanic / keybase.md
Last active August 29, 2015 14:01
keybase proof

Keybase proof

I hereby claim:

  • I am galvanic on github.
  • I am justine (https://keybase.io/justine) on keybase.
  • I have a public key whose fingerprint is 48E3 70D1 829B 90E5 47F1 DF6D 52ED F485 44BD 65E3

To claim this, I am signing this object:

@galvanic
galvanic / toc_ipython.py
Last active June 20, 2016 10:42
Builds a table of contents (TOC) for an IPython notebook.
#!/usr/local/bin/python
'''
Script that automatically builds a table of contents (TOC) for an IPython notebook.
Returns string to paste into notebook.
'''
import sys
import json
@galvanic
galvanic / potato-salad.py
Last active August 29, 2015 14:03
Parser for potato salad kickstarter funding.
#!/usr/bin/env python
"""
Script parses funding reached by the potato salad kickstarter
through lynx CLI browser.
Appends funding and date and time of funding to CSV file
for later plotting.
"""
import sys, re, csv
import datetime
@galvanic
galvanic / hex.py
Created July 14, 2014 13:27
Replace x with hexdecimal values
#!/usr/bin/python
import sys
from itertools import product
string = sys.argv[1]
values = [l for l in "0123456789ABCDEF"]
# replace x by hexdecimal values
@galvanic
galvanic / get_rsvps.py
Last active August 29, 2015 14:15
Meetup.com RSVPs (includes +1s)
from bs4 import BeautifulSoup
import sys
with open(sys.argv[1], 'r') as ifile:
text = ifile.read()
soup = BeautifulSoup(text)
rsvp = soup.find('ul', {'id': 'rsvp-list'})
names = rsvp.find_all('h5')
names = [name.text.encode('utf-8').strip().replace('\n', ' ') for name in names]
@galvanic
galvanic / README.md
Last active July 6, 2016 16:11
Bar chart showing # events per week

Bar chart of number of events per week (week starting on a Monday). The interesting bit was how to group by week while still preserving the notion of time to be able to use months in the x axis. A clipping path was used to not show the beginning of a week where there was no data (data started on a Saturday).

Fake events were generated using this fake-event-generator.

@galvanic
galvanic / README.md
Last active July 6, 2016 16:13
Reusable charts

You can see this chart at: http://bl.ocks.org/galvanic/53d5ecaa09efb809444b

« In effect, the chart becomes a rubber stamp for rendering data visually. »

Mike Bostock

Working example of a reusable chart that is re-used in space and in time (for updates). The reusable chart is the TimelineChart constructor function in timeline.js.

The key function is used to access the bound data in the circles selection to convey that the represented events are different.

@galvanic
galvanic / gist:861138ed2bdf61be3ce7
Last active December 19, 2016 20:17
pyladies scapy
my slides:
https://github.com/galvanic/talk-slides/blob/master/scapy.ipynb
official docs:
http://www.secdev.org/projects/scapy/demo.html
http://www.secdev.org/projects/scapy/doc/usage.html#sniffing
some tutorials from the internet:
https://theitgeekchronicles.files.wordpress.com/2012/05/scapyguide1.pdf
https://samsclass.info/124/proj11/proj17-scapy.html
@galvanic
galvanic / serverRPi.txt
Created June 17, 2015 10:42
Server on Raspberry Pi steps
Plug in RPi with Ethernet cable
Make sure the SD card or some sort of storage is in, so that there is an OS
Plug in RPi with macro-USB for power
http://www.dexterindustries.com/BrickPi/getting-started/using-the-pi/connect-to-your-raspberry-pi-from-a-mac/
https://www.raspberrypi.org/documentation/installation/installing-images/mac.md
http://pingbin.com/2012/07/format-raspberry-pi-sd-card-mac-osx/
http://elinux.org/RPi_Easy_SD_Card_Setup#Copying_an_image_to_the_SD_Card_in_Mac_OS_X
diskutil unmountDisk /dev/disk1s1
sudo dd bs=1m if=~/Downloads/2015-02-16-raspbian-wheezy.img of=/dev/rdisk1
Don't forget to properly eject!