Skip to content

Instantly share code, notes, and snippets.

@kzk
kzk / evhttp-multh-thread-httpd.cpp
Created November 6, 2010 13:53
Multi-Threaded HTTPServer using evhttp
#include <event.h>
#include <evhttp.h>
#include <pthread.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <iostream>
@thwarted
thwarted / sshpub-to-rsa
Created June 14, 2011 09:12
converts an openssh RSA public key into a format usable by openssl rsautl (if you don't have openssh 5.6 or later with ssh-keygen PEM export format)
#!/usr/bin/env python
# with help and inspiration from
# * ASN1_generate_nconf(3) (specifically the SubjectPublicKeyInfo structure)
# * http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL
# * http://blog.oddbit.com/2011/05/converting-openssh-public-keys.html
import sys
import base64
import struct
@carlosvillu
carlosvillu / install_node.sh
Created August 4, 2011 17:22
Configure NodeJs + NPM + NGINX
#!/bin/bash
NODE_VERSION=0.4.10
NPM_VERSION=1.0.22
sudo apt-get update
sudo apt-get install -y build-essential git-core nginx libssl-dev pkg-config curl
# Install node
mkdir -p $HOME/local/node
git clone git://github.com/joyent/node.git
@pipoket
pipoket / udpserver.py
Created November 25, 2011 07:40
UDP server implementation for gevent. Copied from http://code.google.com/p/gevent/issues/detail?id=50
# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details.
"""UDP/SSL server"""
import sys
import errno
import traceback
from gevent import socket
from gevent import core
from gevent.baseserver import BaseServer
@JakSprats
JakSprats / access-berkeleydb-1.cpp
Created December 15, 2011 12:40
LevelDB vs BerkeleyDB benchmark
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <db_cxx.h>
using namespace std;
@baopham
baopham / Monaco for Powerline.otf
Last active April 16, 2023 03:57
Patched font Monaco for OSX Vim-Powerline
@lu1s
lu1s / get-random-flickr-user-pic-jquery.js
Created March 17, 2012 17:21
Get random flickr picture from given user id and append to given div id (needs jquery and flickr api key)
function getPicture(the_user_id, your_div_id){
var apiKey = "YOUR-API-KEY"; // replace this with your API key
var url_to_a_photo_head = "http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key="+apiKey+"&photo_id=";
var url_to_a_photo_tail = "&format=json&jsoncallback=?";
// get an array of random photos
$.getJSON(
"http://api.flickr.com/services/rest/",
@paulmillr
paulmillr / active.md
Last active July 15, 2024 10:55
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 1000)
@laszlomiklosik
laszlomiklosik / Install flash player debug version on Ubuntu 64 bit
Created June 2, 2012 08:20
Install Flash Player debug version in Ubuntu 12.04 64 bit
# no 64 bit version of the flash debug player is available, thus we will use the 32 bit version and use nspluginwrapper to make it work
sudo killall -9 firefox
sudo apt-get remove -y --purge flashplugin-nonfree gnash gnash-common mozilla-plugin-gnash swfdec-mozilla libflashsupport nspluginwrapper
sudo rm -f /usr/lib/mozilla/plugins/*flash*
sudo rm -f ~/.mozilla/plugins/*flash*
sudo rm -f /usr/lib/firefox/plugins/*flash*
sudo rm -f /usr/lib/firefox-addons/plugins/*flash*
sudo apt-get install ia32-libs nspluginwrapper libcurl3 libnss3-1d libnspr4-0d
cd ~
AVFormatContext *formatC = avformat_alloc_context();
AVDictionary* options = NULL;
av_dict_set(&options,"list_devices","true",0);
AVInputFormat *iformat = av_find_input_format("dshow");
avformat_open_input(&formatC,"video=dummy",iformat,&options);