Skip to content

Instantly share code, notes, and snippets.

@Asimov4
Asimov4 / Git cheat sheet
Created February 6, 2012 05:19
Git commands
git rm $(git ls-files --deleted)
@Asimov4
Asimov4 / RegExp
Created April 9, 2012 22:36
Regular Expressions for Notepad++
dbo\.ymdToDate\(([^()]+),([^()]+),([^()]+)\)
replace with
DATE(CONCAT(\1, '-',\2, '-',\3))
@Asimov4
Asimov4 / Caml test
Created April 14, 2012 00:45
Caml test
let altitude = fun n ->
let t = make_matrix (n+2) (n+2) 0 in
for i=1 to n do
for j=1 to n do
t.(i).(j) <- 2
done;
done;
t.(n).(n) <- 1;
let rec aux = fun (u,v) -> match (u,v) with
(u,v) when t.(u).(v) != 2 -> t.(u).(v)
@Asimov4
Asimov4 / Django Bitnami cheat sheet
Last active December 14, 2015 15:39
Django Bitnami cheat sheet
restart apache
sudo /opt/bitnami/ctlscript.sh restart apache
http://raamdev.com/2007/recovering-from-ctrls-in-putty/
https://docs.djangoproject.com/en/dev/intro/tutorial03/
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>
git diff --cached
git pull --rebase
git rebase -i HEAD~4
git add -u
git commit --amend
git push origin fefc50f:mainline # to push a single commit
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
git config --global alias.lgp "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -p"
@Asimov4
Asimov4 / makehub
Created December 9, 2013 01:02 — forked from stefania11/makehub
Moss oscilator
# Title
Moss oscilator
# Picture
media: http://s24.postimg.org/3pqmzrp5h/Screen_Shot_2013_11_30_at_2_26_50_AM.png
# Objective
Building a 'Mosscillator' - a mixture of moss and oscillator. By touching moss the organic structures of moss are decreasing conductivity and can be therefore used as pressure sensor. The touch of moss will control sounds and noises generated by an oscillator chip.This way we can make a moss symphony together, consisting of several Mosscillators created during the workshop
# Duration
40
# Age Group
all
@Asimov4
Asimov4 / makehub
Created December 22, 2013 08:21 — forked from eldraelin/makehub
TURBO
# Title
TURBO
# Picture
media: http://oblikon.net/wp-content/uploads/turbo-course.jpg
# Objective
The world fastest snail
# Duration
10
# Age Group
all
// ==UserScript==
// @name Amazon Auto-Smile
// @namespace
// @version 0.1
// @description Automatically redirects all www.amazon.com URLs to their smile.amazon.com equivalent.
// @match http://www.amazon.com/*
// @match https://www.amazon.com/*
// @run-at document-start
// @copyright 2013
// ==/UserScript==
@Asimov4
Asimov4 / resume_after_next.md
Created February 17, 2014 03:39 — forked from mikedeboer/resume_after_next.md
Why to call resume() after next()

When we write Connect middlewares that contain async operations, it is good practice to 'pause' the HTTP request with the help of the Connect utility function. When the async operation has finished, the HTTP request is resumed again. Let's have a look at the documentation for this utility:

Pause `data` and `end` events on the given `obj`.
Middleware performing async tasks _should_ utilize
this utility (or similar), to re-emit data once
the async operation has completed, otherwise these
events may be lost.