Skip to content

Instantly share code, notes, and snippets.

@quark-zju
quark-zju / gdb-trace.py
Last active Aug 20, 2021
Trace all function calls using gdb
View gdb-trace.py
#!/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 Nov 27, 2021
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!
View curl_libuv_example.c
#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 Feb 24, 2018
install chef server 11
View install-chef-server.txt
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/
View favicon.html
<!-- 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 Nov 10, 2010 — forked from zhengjia/gist:395021
rcov raketask for Rails 3, RSpec 2
View rcov.rake
# 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 Sep 2, 2010
30 minutes Lisp in Ruby
View lisp.rb
# 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,
View gist:514766
// for example purposes
@implementation RLHTMLView : CPView
{
DOMElement HTMLDOMElement;
}
- (id)initWithFrame:(CGRect)aRect
{
self = [super initWithFrame:aRect];