Skip to content

Instantly share code, notes, and snippets.

@4poc
4poc / gist:835763
Created February 20, 2011 06:13
pubsub scribble / debug server
protocol specification: http://pubsubhubbub.googlecode.com/svn/trunk/pubsubhubbub-core-0.3.html
test feed: http://apubtest.wordpress.com/feed/ (atom)
hub: <atom:link rel='hub' href='http://apubtest.wordpress.com/?pushpress=hub'/>
-> http://apubtest.wordpress.com/?pushpress=hub
topic/self: <atom:link href="http://apubtest.wordpress.com/feed/" rel="self" type="application/rss+xml" />
-> http://apubtest.wordpress.com/feed/
@4poc
4poc / gist:837530
Created February 21, 2011 19:07
HTTP Caching Cheat Sheet
1. Last-Modified
Server->Client: Last-Modified: Mon, 21 Feb 2011 ... (200)
Client->Server: If-Modified-Since: Mon, 21 Feb 2011 ... (200/304)
2. ETag
Server->Client: ETag: 123456654321 (200)
Client->Server: If-None-Match: 123456654321 (200/304)
#!/bin/bash
#
# http://wiki.videolan.org/VLC_command-line_help
# http://wiki.videolan.org/Documentation:Modules/screen
# http://apiwiki.justin.tv/mediawiki/index.php/Linux_Broadcasting_API
# StreamKey: http://www.justin.tv/broadcast/adv_other
#
cvlc screen:// \
--screen-width 1356 \
@4poc
4poc / pacman (< 3.5!!!)
Created March 9, 2011 06:56
Slow Pacman Workaround(< 3.5!!!)
This is obsolete with the new pacman version 3.5!
Pacman (arch linux) uses a file based database with a lot
of small files. Some filesystems are awfully slow when
accessing lots of small files, in general this is not
that great of a deal because most of the applications
store their information with more sense. Pacman doesn't
care (it is a long well known problem), which means that
sometimes you have to wait minutes before a search query
completes (pacman -Ss).
@4poc
4poc / vimrc_stop_using_arrow_keys
Created March 11, 2011 08:46
Learning vim, try to stop using the arrow keys ;)
" stop using arrow keys!
map <UP> d'oh!
map <DOWN> d'oh!
map <LEFT> d'oh!
map <RIGHT> d'oh!
imap <UP> d'oh!
imap <DOWN> d'oh!
imap <LEFT> d'oh!
imap <RIGHT> d'oh!
@4poc
4poc / LimitStream.js
Created December 10, 2011 03:41
Node.js: LimitStream (Bandwidth limited Readable+Writable Stream)
var fs = require('fs'),
util = require('util'),
Stream = require('stream').Stream;
/**
* Create a bandwidth limited stream
*
* This is a read+writeable stream that can limit how fast it
* is written onto by emitting pause and resume events to
* maintain a specified bandwidth limit, that limit can
@4poc
4poc / gist:1565186
Created January 5, 2012 13:06
ffmpeg / mpeg-ts / m3u8 / HLS
ffmpeg \
-i INPUT_FILE \
-re \
-r 23.976 \
-s 480x204 \
-aspect 2.35 \
-acodec libfaac \
-ac 2 \
-ar 44100 \
-ab 128k \
@4poc
4poc / GalleryAdapter.java
Created March 1, 2012 22:11
GalleryAdapter.java
public void onNewItems(List<Item> newItems) {
notifyDataSetChanged();
} //just a test
@4poc
4poc / const pointer.cc
Created July 2, 2012 17:37
random c++ stuff
int main(int argc, char **argv) {
int num = 42;
// marks value the ptr is refering as constant
const int *p1 = &num;
// (*p1)++; // illegal
p1++; // legal
///////////////////////////////////////////////////
@4poc
4poc / cp437.hpp
Created July 12, 2012 01:16
Code page 437
/*
Code page 437 is the charset used by the original IBM PC,
it includes a wide variety of graphical symbols for ascii
drawings.
In this implementation I define unicode code points that
match the original cp437 symbols. The table also includes
the unique character name and if available the 7-bit
US-ASCII character.