Skip to content

Instantly share code, notes, and snippets.

@sebbu2
sebbu2 / g++_stl_cleaner.pl
Created June 24, 2011 18:04
Clean the output of g++ with STL errors
#!/usr/bin/perl -w
use strict;
use warnings;
while (<>)
{
$\="\n";
s/^\s+//;
s/\s+$//;
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

anonymous
anonymous / backup.php
Created June 13, 2012 20:39
Backup with php
<?php
require_once('config.php');
//var_dump(umask());die();
umask(0000);
clearstatcache();
$filename='html.zip';
$filename2='html_updated.zip';
function list_dir($dir, &$ar) {
assert(substr($dir,-1)=='/') or die('directory need to end with /');
@sebbu2
sebbu2 / fast_image_size_reader.cpp
Created June 19, 2012 19:16
Fast Image Size Reader
#include <vector>
#include <cerrno>
#include <climits>
#include "fast_image_size_reader.hpp"
#include "crc32.hpp"
enum file_type get_file_type(const char* filename) {
assert(strcmp(filename,"")!=0);
enum file_type res=UNKNOWN;
FILE* fp=fopen(filename, "rb");
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@archagon
archagon / gdc-downloader.py
Last active April 12, 2025 19:12
A quick and dirty script to download GDC Vault videos.
# GDC Vault videos can't be watched on mobile devices and this is a very sad thing indeed!
# (Note: this has changed for GDC2013, which lets you watch raw MP4 streams. Kudos!)
# This script is designed to circumvent this by downloading the lecture and slideshow
# videos which can then be re-encoded into whatever format you wish. Obviously, you
# won't be able to do this without access to the Vault. This is strictly for the
# convenience of legitimate Vault users!
# Note: this code is rather flimsy and was written as fast as possible for my own personal use.
# The code only works for the most recent GDC Vault videos, since they all use the same player
# format. If the XML format used to run the player is changed (as it has in the past), the code
@Schnouki
Schnouki / movmd.py
Created February 25, 2013 08:20
.mov/.mp4 metadata (date/time) editor
#!/usr/bin/env python3
# -*- mode: python -*-
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law. You can redistribute it and/or modify it under
# the terms of the Do What The Fuck You Want To Public License, Version 2, as
# published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
# details.
# Some useful resources:
@servel333
servel333 / git-config.sh
Last active September 26, 2022 21:24
Nate's custom git log. One line, graphed, colored, with hash, branches, time, author and description.
## Normal git log
git log -3
# commit 58c7c712ad122bb4739a761d71684dcb23364831
# Author: Nathan Perry <[email protected]>
# Date: Wed Mar 19 22:10:39 2014 -0400
#
# Update README.md
#
# commit cd3137dad3d7debd622885445e0d117246b65603