Skip to content

Instantly share code, notes, and snippets.

View mutaku's full-sized avatar
🌌
Latent Layer 5

Matthew Martz mutaku

🌌
Latent Layer 5
View GitHub Profile
@mutaku
mutaku / gist:996599
Created May 28, 2011 04:33
imgur python
class UploadImage():
"""
Upload images to imgur
returns either .error or .imageURL
TO DO:
POSSIBLE TO DO:
- add stats and image info functions
- allow for full JSON responses instead of having to manually parse XML
@ryanseddon
ryanseddon / NanoMCE.html
Created June 24, 2011 05:39
Worlds smallest WYSIWYG with live preview
<!-- Paste it in your address bar -->
data:text/html,<pre onkeyup="(function(d,t){d[t]('iframe')[0].contentDocument.body.innerHTML = d[t]('pre')[0].textContent;})(document,'getElementsByTagName')" style="width:100%;height:48%;white-space:pre-wrap;overflow:auto;" contenteditable></pre><iframe style="width:100%;height:48%">
@gljeremy
gljeremy / disconnect.rb
Created September 21, 2011 14:03 — forked from tmcw/disconnect.rb
bulk-export run data from Garmin Connect
#!/usr/bin/env ruby
## disconnect
# ./disconnect.rb -u yourusername [-o /your/path] [-p yourhttpproxyserver]
#
# This is a command-line utility for the bulk-downloading of run data from
# the connect.garmin.com web application, which has lackluster export
# capabilities.
#
Compression:
xz:
real 18m43.520s
user 18m37.840s
sys 0m4.020s
gzip:
real 1m52.749s
user 1m42.180s
sys 0m3.260s
@jboner
jboner / latency.txt
Last active July 22, 2024 14:44
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
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 21, 2024 20:54
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@omarish
omarish / gist:3080200
Created July 10, 2012 00:42
Priceonomics Puzzles

Priceonomics Programming Puzzle, Summer 2012

We love solving puzzles at Priceonomics. We also like meeting people who like to solve puzzles. Here are two interesting puzzles we've faced at some point in the past months that we'd like to share with you.

If you have any questions, contact omar@priceonomics.com.


Puzzle 1: Heatwave

@mutaku
mutaku / store_credit.py
Created August 7, 2012 21:58
Google code challenge - credit
#!/usr/bin/env python
# Google Code Challenge - Credit Problem
# http://code.google.com/codejam/contest/351101/dashboard#s=p0
import itertools
import bisect
from time import time
def last(array, num):
@mutaku
mutaku / palindrome.cpp
Created November 15, 2012 21:23
palindromes (output stuffs here: https://gist.github.com/4219658 )
/* palindrome.cpp
* C++ implementation of palindrome.py
* (https://gist.github.com/4081368)
*
* - Matthew Martz 2012
*/
#include <iostream>
#include <string>
#include <sstream>
@Bpless
Bpless / shell_plus_reloader.py
Last active June 5, 2018 11:40
Shell_Plus reloader thread
class ReloaderEventHandler(FileSystemEventHandler):
"""
Listen for changes to modules within the Django project
On change, reload the module in the Python Shell
Custom logic required to reload django models.py modules
Due to the singleton AppCache, which caches model references.
For those models files, we must clear and repopulate the AppCache
"""
def __init__(self, *args, **kwargs):