Skip to content

Instantly share code, notes, and snippets.

View cschaba's full-sized avatar

Carsten Schabacker cschaba

View GitHub Profile
{
"awayIndicator": "#e0b333",
"buttonBg": "#859900",
"buttonColor": "#586e75",
"centerChannelBg": "#fdf6e3",
"centerChannelColor": "#839496",
"codeTheme": "solarized-light",
"linkColor": "#268bd2",
"mentionBj": "#dc322f",
"mentionColor": "#ffffff",
@cschaba
cschaba / Pythonista-uncompress.py
Created February 8, 2019 21:16
Pythonista extension script to decompress GZIP file and then open in ...
# coding: utf-8
# PYTHONISTA extension - uncompress GZIP Files
import appex
import console
import re
import gzip
import os.path
import shutil
@cschaba
cschaba / gist:cd735c6f8eb26e11a0cb
Last active August 29, 2015 14:25 — forked from siddhadev/gist:5814802
Bash script for fixing subversion's "Working copy text base is corrupt" error
#!/bin/bash
set -e
usage(){
echo "Error $errcode $errorcode at line ${BASH_LINENO[0]} while executing: $BASH_COMMAND"
exit $errorcode
}
trap usage ERR
# chat server using multicast
# python fork of the original ruby implementation
# http://tx.pignata.com/2012/11/multicast-in-ruby-building-a-peer-to-peer-chat-system.html
# receiver.py
# usage : $ python receiver.py # wait for messages to come in
import socket
import struct
multicast_addr = '224.0.0.1'
@cschaba
cschaba / keyboard.js
Created February 22, 2013 11:18 — forked from bebraw/keyboard.js
var keyboard = function(window) {
var keyboard = window.keyboard || {};
if (!('isPressed' in keyboard)) {
keyboard._keys = {};
var handler = function(e, flag) {
var key = String.fromCharCode(e.which).toLowerCase();
keyboard._keys[key] = flag;
@cschaba
cschaba / Fetch.sublime-settings
Created February 17, 2013 17:47
Fetch.sublime-settings - my settings for Sublime "Fetch" Extension
{
"files":
{
"HTML: bootstrap-starter.html": "http://twitter.github.com/bootstrap/examples/starter-template.html",
"Javascript: backbonejs": "http://backbonejs.org/backbone-min.js",
"Javascript: jquery": "http://code.jquery.com/jquery.min.js",
"Javascript: jquerymobile": "http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js",
"CSS: jquerymobile.css": "http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css",
"Javascript: modernizr": "http://modernizr.com/downloads/modernizr-latest.js",
"CSS: normalize.css": "https://raw.github.com/necolas/normalize.css/master/normalize.css",
@cschaba
cschaba / gist:4740380
Created February 8, 2013 17:01
PHP: parse output of ifconfig (tested with Ubuntu Linux)
<?php
// from http://www.highonphp.com/regex-pattern-parsing-ifconfig
$data = <<<EOF
eth0 Link encap:Ethernet HWaddr 00:50:56:33:B6:D2
inet addr:192.168.12.103 Bcast:192.168.12.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1337 errors:0 dropped:0 overruns:0 frame:0
TX packets:985 errors:0 dropped:0 overruns:0 carrier:0
@cschaba
cschaba / gist:4740323
Created February 8, 2013 16:54
PHP: parse output of "df -k"
$data = <<<EOF
Filesystem 1K-blocks Used Available Use% Mounted on
ubi0_0 143180 89740 53440 63% /
tmpfs 64 0 64 0% /dev
tmpfs 143124 76 143048 0% /tmp
tmpfs 4096 912 3184 22% /var
tmpfs 64 0 64 0% /mnt
ubi1_0 468256 12144 456112 3% /opt/data/settings
EOF;