Skip to content

Instantly share code, notes, and snippets.

@c0ldlimit
c0ldlimit / gist:9aeacdbd42269cf76a58
Created August 12, 2014 15:36
Checking #python files for tab issues
# check if there are tab issues in python
python -m tabnanny yourfile.py
# in vim
:%retab
@c0ldlimit
c0ldlimit / gist:f3856f83844a49b73ff4
Created August 15, 2014 22:33
#python pip install inside ipython notebook
#saves having to exit and install stuff
import pip
def install(package):
pip.main(['install', package])
@c0ldlimit
c0ldlimit / gist:6228e8d63dc34c71a552
Last active August 29, 2015 14:05
#linux commands cheatsheet
# copy an entire directory
cp -R dirtocopy/ newdir/
# view the last modified file in a directory
less $(ls -t *.out | head -1)
# redirection
# http://superuser.com/questions/480599/with-regards-to-piping-commands-what-are-the-greater-than-and-less-than
# http://en.wikipedia.org/wiki/Redirection_%28computing%29
> "output to"
@c0ldlimit
c0ldlimit / gist:cec11d9441df163dbb78
Created August 27, 2014 14:35
#excel removing an add in
http://stackoverflow.com/questions/1946551/excel-add-in-doesnt-get-the-hint
C:\Program Files\Microsoft Office\Office*Version*\Xlstart
C:\Documents and Settings\*User name*\Application Data\Microsoft\Excel\XLSTART
Also, check the registry for Excel OPEN entries. Start -> Run -> regedit -> HKEY_CURRENT_USER\Software\Microsoft\Office\*version*\Excel\Options. Look for any values named OPEN*x*.
import gevent
from gevent.queue import Queue
tasks = Queue()
def worker(n, work_time):
while not tasks.empty():
task = tasks.get()
print("Worker %s got tasks %s" % (n, task))
gevent.sleep(work_time) # releases the greenlet to go do something else
<div id="main-container">
<div id="main">
<h1>
<img alt="scubabook logo" src="{{ static_url("img/logo.png") }}">
</h1>
<div id="login-form">
<form action="/auth/login/" method="post" id="login_form">
<fieldset>
<label for="username">Username</label>
<input autocapitalize="off" autocorrect="off" class="text-input" id="username" name="username" tabindex="1" type="text" value="">
#include<stdio.h>
int main(int argc, char * argv[]) {
float f = 19.86;
int x, k;
for (k=0; k < 32; ++k) {
x = *(int*)&f >> (k);
@c0ldlimit
c0ldlimit / gist:43d30e56ac050b9e9e48
Created October 21, 2014 18:31
#python #virtualenv #windows
http://stackoverflow.com/questions/6114115/windows-virtualenv-pip-numpy-problems-when-installing-numpy
@c0ldlimit
c0ldlimit / gist:a5094352e1d99961957d
Created November 3, 2014 18:48
#linear #algebra notes
When a matrix can be inverted:
- matrix is a square matrix
- linearly independent columns
- the span of the basis is the basis R^n
if C is invertible then the span of B = R^n
span of B is R^n then C is invertible
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
// my CPU has 32K of L1 cache
#define L1_CACHE_CAPACITY (32768 / sizeof(int))
int array[L1_CACHE_CAPACITY][L1_CACHE_CAPACITY];
struct timespec time_diff(struct timespec start, struct timespec end) {