Skip to content

Instantly share code, notes, and snippets.

@quark-zju
quark-zju / gdb-trace.py
Last active December 31, 2023 14:14
Trace all function calls using gdb
#!/usr/bin/env python
try:
import gdb
inside_gdb = True
except ImportError:
inside_gdb = False
if inside_gdb:
@clemensg
clemensg / curl_libuv_example.c
Last active November 2, 2023 01:48
An example on how to use libuv with libcurl's multi interface Should be equally fast on Unixes (uses epoll/kqueue/etc like libev/libevent) but MUCH faster on Windows due to libuv's usage of IO completion ports. Could come in handy if you have to manage several hundreds or thousands of connections!
#include <stdio.h>
#include <stdlib.h>
#include <uv.h>
#include <curl/curl.h>
uv_loop_t *loop;
CURLM *curl_handle;
uv_timer_t timeout;
typedef struct curl_context_s {
@lvnilesh
lvnilesh / install-chef-server.txt
Last active February 24, 2018 17:07
install chef server 11
http://docs.opscode.com/chef/install_server.html
http://www.ducea.com/2013/03/05/howto-migrate-to-chef-11/
wget https://opscode-omnitruck-release.s3.amazonaws.com/ubuntu/12.04/x86_64/chef-server_11.0.6-1.ubuntu.12.04_amd64.deb
sudo dpkg -i chef-server*
sudo chef-server-ctl reconfigure
sudo chef-server-ctl test
mkdir -p ~/.chef
sudo cp /etc/chef-server/chef-webui.pem ~/.chef/
@ravasthi
ravasthi / favicon.html
Created January 7, 2012 17:53
Favicon code
<!-- Favicons and touch icons -->
<!-- For retina-display iPads -->
<link href="/assets/images/apple-touch-icon-xlarge.png" rel="apple-touch-icon-precomposed" sizes="144x144" type="image/png"/>
<!-- For retina-display iPhones -->
<link href="/assets/images/apple-touch-icon-large.png" rel="apple-touch-icon-precomposed" sizes="114x114" type="image/png"/>
<!-- For iPad 1 -->
<link href="/assets/images/apple-touch-icon-medium.png" rel="apple-touch-icon-precomposed" sizes="72x72" type="image/png"/>
<!-- For iPhone 3G, iPod Touch and Android -->
<link href="/assets/images/apple-touch-icon-small.png" rel="apple-touch-icon-precomposed" type="image/png"/>
<!-- For Nokia -->
@alexdreher
alexdreher / rcov.rake
Created November 10, 2010 00:24 — forked from zhengjia/gist:395021
rcov raketask for Rails 3, RSpec 2
# Forked to get it working with Rails 3 and RSpec 2
#
# From http://github.com/jaymcgavren
#
# Save this as rcov.rake in lib/tasks and use rcov:all =>
# to get accurate spec/feature coverage data
#
# Use rcov:rspec or rcov:cucumber
# to get non-aggregated coverage reports for rspec or cucumber separately
@dahlia
dahlia / lisp.rb
Created September 2, 2010 07:52
30 minutes Lisp in Ruby
# 30 minutes Lisp in Ruby
# Hong Minhee <http://dahlia.kr/>
#
# This Lisp implementation does not provide a s-expression reader.
# Instead, it uses Ruby syntax like following code:
#
# [:def, :factorial,
# [:lambda, [:n],
# [:if, [:"=", :n, 1],
# 1,
// for example purposes
@implementation RLHTMLView : CPView
{
DOMElement HTMLDOMElement;
}
- (id)initWithFrame:(CGRect)aRect
{
self = [super initWithFrame:aRect];