Skip to content

Instantly share code, notes, and snippets.

@eur0pa
eur0pa / eur0pa-dks_deathtoll.py
Last active October 7, 2022 14:00
Dark Souls Deaths Counter
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import struct
def main():
with open('DRAKS0005.sl2', 'rb') as fo:
fo.seek(0x2c0, 0)
for slot in range(0, 10):
fo.seek(0x100, 1)
@standage
standage / asmbleval.pl
Last active February 15, 2020 17:46
Calculate summary statistics for a genome/transcriptome assembly.
#!/usr/bin/env perl
use strict;
$/ = ">";
<STDIN>; # Discard "junk", if any, at beginning of the file.
my @sequencelengths;
my $gccontent = 0;
my $atcontent = 0;
my $combinedlength = 0;
@jboner
jboner / latency.txt
Last active July 27, 2024 12:32
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@baali
baali / dlAttachments.py
Created May 8, 2012 08:32
Python script to download all gmail attachments.
# Something in lines of http://stackoverflow.com/questions/348630/how-can-i-download-all-emails-with-attachments-from-gmail
# Make sure you have IMAP enabled in your gmail settings.
# Right now it won't download same file name twice even if their contents are different.
import email
import getpass, imaplib
import os
import sys
detach_dir = '.'
@coldnebo
coldnebo / Default (OSX).sublime-keymap -- User
Created February 3, 2012 16:21
Sublime Text 2 fix for OSX home/end keys
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} }
@davidnunez
davidnunez / gist:1404789
Created November 29, 2011 13:20
list all installed packages in android adb shell
pm list packages -f
@vpetro
vpetro / gist:1174019
Created August 26, 2011 18:10
Return multiple items from a mocked function with Python's mock.
import mock
def returnList(items):
def func():
for item in items:
yield item
yield mock.DEFAULT
generator = func()