This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check if there are tab issues in python | |
python -m tabnanny yourfile.py | |
# in vim | |
:%retab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#saves having to exit and install stuff | |
import pip | |
def install(package): | |
pip.main(['install', package]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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=""> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stackoverflow.com/questions/6114115/windows-virtualenv-pip-numpy-problems-when-installing-numpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) { |