Skip to content

Instantly share code, notes, and snippets.

View kika's full-sized avatar

Kirill Pertsev kika

View GitHub Profile
@kika
kika / gist:3845193
Created October 6, 2012 15:18
Bitter coffee
options = require( "optimist" )
.usage( "repro case" )
.check( (argv) ->
unless( argv )
throw "gonna die really soon"
)
.argv
## WTF below ##
runupload = (db, data, cb) ->

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

@kika
kika / CGSSpaces.h
Last active January 2, 2018 12:31 — forked from puffnfresh/CGSSpaces.h
#include <Carbon/Carbon.h>
typedef void *CGSConnectionID;
extern CGSConnectionID _CGSDefaultConnection(void);
#define CGSDefaultConnection _CGSDefaultConnection()
typedef uint64_t CGSSpace;
typedef enum _CGSSpaceType {
kCGSSpaceUser,
kCGSSpaceFullscreen,
#!/bin/sh
# this is written in sh not bash because I run it in the FreeBSD jail
# on a FreeNAS box
# directories 1 level under this root would be backed up, one backup file
# per firectory. Backup files would be named 'name of the directory'-'date'
# f.e. /mnt/data would be backed up as data-04-04-2015
# backup ignores all directories where it finds a file .gnutar.nobackup and all
# directories under it
ROOT=/mnt
@kika
kika / gist:e7d927ad8780fc485e2d
Created August 14, 2015 03:46
OS/X: Get the durations of the list of audio files and output CSV
mdls -name "kMDItemDisplayName" -name "kMDItemDurationSeconds" -raw *.wav | xargs -0 -L 2 echo | awk '{print $1 "," $2}'
@kika
kika / printf.purs
Last active June 20, 2017 13:11
Purescript variadic function - function with variable number of arguments of variable type
module Main where
import Prelude (class Show, Unit, ($), show, (++), (<<<))
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
import Data.String (joinWith)
import Data.ExistsR
class PrintF t where
printf' :: Array String -> t
module Main where
import Prelude
import Control.Monad.Eff
import Control.Monad.Eff.Console
type Config = {
debug::Boolean
}
@kika
kika / .vimrc
Created July 29, 2016 20:52
vimrc
colorscheme torte
if $SHELL =~ 'bin/fish'
set shell=/bin/sh
endif
"set lines=55
"set columns=83
set ruler
set dir=~/.vimswap//,/var/tmp//,/tmp//,.
set ts=4
set sw=4
module DBResponse where
import Prelude
import Data.Foreign
import Data.Foreign.Class
data Doc a = Doc { doc :: a }
data CustomerResp = CustomerResp { rows :: Array (Doc Customer) }
data Customer = Customer {
@kika
kika / combinators.md
Created August 27, 2016 00:48
How haskellers talk IRL
!    - No  
!!&! - No, No and NO!!  
.    - Period  
!&.  - No, period  
=    - Equal  
*    - All  
~*   - Not all/everything  
*=   - All the same/I don't care  
~*=? - Isn't everything the same?