Skip to content

Instantly share code, notes, and snippets.

View populate-extfs.sh
#!/bin/sh
do_usage () {
cat << _EOF
Usage: populate-extfs.sh <source> <device>
Create an ext2/ext3/ext4 filesystem from a directory or file
source: The source directory or file
device: The target device
View log.txt
azat:/tmp$ wget https://gist.github.com/Qolt/5614809/raw/5d2d29292cb3fff8243202973f5db936117a6e1e/modeling.py
--2013-05-20 23:32:56-- https://gist.github.com/Qolt/5614809/raw/5d2d29292cb3fff8243202973f5db936117a6e1e/modeling.py
Resolving gist.github.com (gist.github.com)... 204.232.175.94
Connecting to gist.github.com (gist.github.com)|204.232.175.94|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘modeling.py’
[ <=> ] 3,538 --.-K/s in 0s
View .gitconfig
[log]
decorate = short
[color]
ui = auto
[pager]
status = true
show-branch = true
[rebase]
autosquash = true
View punch.py
#!/usr/bin/python
import ctypes
import ctypes.util
c_off_t = ctypes.c_int64
def make_fallocate():
libc_name = ctypes.util.find_library('c')
libc = ctypes.CDLL(libc_name)
View main.c
#include<iostream>
#include "mergesort.c"
using namespace std;
int main(int argc, char** argv) {
int num;
cout << "How many numbers do you want to sort: ";
cin >> num;
int a[num];
for (int i = 0; i < num; i++) {
@azat
azat / chunk.c
Created Sep 20, 2012 — forked from rgl/chunk.c
HTTP chunked transfer in a libevent server
View chunk.c
/*
This shows how to use HTTP chunked transfer in libevent. It starts an HTTP server on port 8080; when the client connects, it outputs an message every second. After all messages are outputted, the server closes the HTTP connection.
It has an unsolved crashing problem though... to see it crash, run the next commands in a shell.
See my ML post "after the http client abruptly closes socket libevent (2.0.3-alpha) http server crashes" at http://archives.seul.org/libevent/users/Jan-2010/msg00054.html
Compile with:
gcc -Wall -g -std=c99 -D_GNU_SOURCE -Iinclude -Llib -levent -o chunk chunk.c
@azat
azat / dump.php
Created Jun 22, 2012 — forked from jmikola/dump.php
Testing bson_decode() and bson_encode() in PHP
View dump.php
<?php
// dump.php [database] [collection] [filename]
function dump(MongoCollection $collection, $filename) {
$file = fopen($filename, 'w');
foreach ($collection->find() as $document) {
fwrite($file, bson_encode($document));
}