Skip to content

Instantly share code, notes, and snippets.

View aerosol's full-sized avatar
🌞
Praise the sun

hq1 aerosol

🌞
Praise the sun
View GitHub Profile
[user]
name = Rafał Gałczyński
email = rafalgalczynski@gmail.com
editor = vim
[diff]
tool = vimdiff
[color]
branch = auto
diff = auto
status = auto
void rotate(char *log_record_time)
{
struct tm *now = NULL;
time_t time_value = 0;
FILE *nf;
FILE *tf;
char* fname;
time_value = time(NULL); /* Get time value */
now = localtime(&time_value); /* Get time and date structure */
@fdmanana
fdmanana / gist:832610
Created February 17, 2011 20:27
The CouchDB replicator database

1. Introduction to the replicator database

A database where you PUT/POST documents to trigger replications and you DELETE to cancel ongoing replications. These documents have exactly the same content as the JSON objects we used to POST to /_replicate/ (fields "source", "target", "create_target", "continuous", "doc_ids", "filter", "query_params".

Replication documents can have a user defined "_id". Design documents (and _local documents) added to the replicator database are ignored.

The default name of this database is _replicator. The name can be changed in the .ini configuration, section [replicator], parameter db.

2. Basics

@eproxus
eproxus / virus.erl
Created March 4, 2011 09:26
A small module that jumps between connected nodes
%% @doc A small module that jumps between connected nodes.
%% @author Gianfranco Alongi <gianfranco.alongi@gmail.com>
%% @author Adam Lindberg <hello@alind.io>
-module(virus).
-export([start/0]).
-export([start/1]).
start() -> spawn_process(code:get_object_code(?MODULE)).
start(Beam) -> spawn_process(Beam).
@mtigas
mtigas / gist:952344
Last active April 3, 2024 07:57
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

@narfdotpl
narfdotpl / gist:1180921
Created August 30, 2011 13:47
memory leak in a Django app
# source of a massive memory leak in a Django app (if obj is QuerySet):
if not obj:
return None
@aerosol
aerosol / tellterm.applescript
Created February 20, 2012 19:12
Talk to iTerm REPLs (erlang, python etc)
-- Talk to iTerm REPLs
-- usage:
-- osascript tellterm.applescript "hi."
-- osascript tellterm.applescript "print 'hi'" "python (Python)" python
on run argv
set stdin to item 1 of argv
set repl_name to "erl (beam.smp)"
set run_repl to "erl -pa ebin -pa deps/ebin"
set default_session to "Default Session"
@seancribbs
seancribbs / xmlsimple.erl
Created February 27, 2012 20:18
Module to simplify XML reading/manipulation stuffs in Erlang
%% @doc Uses SAX to convert an XML document into a simple nested-tuple
%% structure. Ignores namespaces.
-module(xmlsimple).
-export([file/1,
string/1,
emit/1,
emit_file/2]).
-include_lib("xmerl/include/xmerl.hrl").
@rnewson
rnewson / gist:2387973
Created April 14, 2012 21:31
CouchDB Future Feature List - Round 2
A list of features that we want to see in CouchDB. Needs to be voted on so that it can become a priority queue.
User Facing Features
====================
1. Conflicts are the rule, not the exception
All previous versions of CouchDB hide conflicts by default (selecting
an arbitrary but consistent winning revision). Expert users can find
and resolve conflicts.
@ljos
ljos / cocoa_keypress_monitor.py
Last active January 6, 2024 07:36
Showing how to listen to all keypresses in OS X through the Cocoa API using Python and PyObjC
#!/usr/bin/env python
#
# cocoa_keypress_monitor.py
# Copyright © 2016 Bjarte Johansen <Bjarte.Johansen@gmail.com>
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# “Software”), to deal in the Software without restriction, including