Skip to content

Instantly share code, notes, and snippets.

View pce's full-sized avatar

pce

  • UTC+1
View GitHub Profile
@pce
pce / drawarea.c
Created March 11, 2013 13:19
gcc -Wall drawarea.c -o drawarea `pkg-config --cflags --libs gtk+-2.0`
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
static gboolean button_pressed (GtkWidget*, GdkEventButton*, GArray*);
static gboolean motion_notify (GtkWidget*, GdkEventMotion*, GPtrArray*);
static gboolean key_pressed (GtkWidget*, GdkEventKey*, GPtrArray*);
static gboolean expose_event (GtkWidget*, GdkEventExpose*, GArray*);
static gboolean ui_draw_grid (GtkWidget *area);
static gboolean ui_draw_boxes (GtkWidget *area);
static gboolean ui_redraw (GtkWidget *area, GArray *steparray);
@pce
pce / funterminal.js
Last active December 14, 2015 04:59
"use strict";
function trace(s) {
if (typeof console != "undefined") {console.log(s);}
}
var TerminalHistory = function () {
this.cmd = [];
this.cmdIndex = 0;
@pce
pce / awesome_debian.md
Last active December 14, 2015 03:28
my awesome debian

Create a bootable USB Stick to install debian

In the Example is /dev/sdb the unmounted usb stick.

$ dd if=debian-testing-i386-netinst.iso of=/dev/sdb
516096+0 records in
516096+0 records out
264241152 bytes (264 MB) copied, 92.3948 s, 2.9 MB/s
#!/usr/bin/env bash
USAGE="$0 <arg1>"
if [ $# -eq 0 ] ; then
echo $USAGE
exit 1
fi
@pce
pce / wget
Last active December 11, 2015 14:28
# get all pdf files of website
# Syntax: wget --recursive --accept .pdf <URL>
#
$ wget -r -A.pdf http://www.example.com/folder/
#
# with level of recursion
$ wget --recursive --accept .pdf --level=3 --no-host-directories --no-parent http://www.example.com/
@pce
pce / .vimrc
Last active October 13, 2015 17:38
vimrc
syntax on
filetype plugin indent on
set paste
set ruler
set expandtab "Convert tabs to spaces - Expand Tab"
set tabstop=4 "Length of tab"
"Optional: "
@pce
pce / main.js
Created October 31, 2012 19:48
StepSequencer without GUI with gamejs
var gamejs = require('gamejs');
var mixer = require('gamejs/mixer');
var stepsequencer = require('stepsequencer');
var FPS = 60;
var BPM = 100;
var extAudio = ".ogg";
// var extAudio = ".wav";
@pce
pce / .bash_alias
Created May 30, 2012 23:44
cat ~/.bash_alias >> ~/.bashrc && source ~/.bashrc
# duh - disk usage humanreadable, source 'inataysia' reddit
alias duh='du -sk * | sort -n | while read size fname; do for unit in k M G T P E Z Y; do if [ $size -lt 1024 ]; then echo -e "${size}${unit}\t${fname}"; break; fi; size=$((size/1024)); done; done'
@pce
pce / .zshrc
Created February 29, 2012 22:22
cat ~/.zshrc
# PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m%{$fg[yellow]%}%~%{$reset_color%}%%"
local blue_op="%{$fg[blue]%}[%{$reset_color%}"
local blue_cp="%{$fg[blue]%}]%{$reset_color%}"
local path_p="${blue_op}%~${blue_cp}"
local user_host="${blue_op}%n@%m${blue_cp}"
local ret_status="${blue_op}%?${blue_cp}"
local hist_no="${blue_op}%h${blue_cp}"
local smiley="%(?,%{$fg[green]%}:%)%{$reset_color%},%{$fg[red]%}:(%{$reset_color%})"
PROMPT="╭─${path_p}─${user_host}
@pce
pce / example-asciimap_read.php
Created December 11, 2011 13:59
ascii map text-format read example
<?php
function asciimap_read($s)
{
$out = '';
$instructions = explode('|', $s);
foreach ($instructions as $instruction) {
$_ = explode(':', $instruction);
$count = $_[0];
$ascii = $_[1];