Skip to content

Instantly share code, notes, and snippets.

View Sannis's full-sized avatar
🎯
Focusing

Oleg Efimov Sannis

🎯
Focusing
View GitHub Profile
// Behavior explanation: http://dev.mysql.com/doc/refman/5.1/en/auto-reconnect.html
// Set MYSQL_OPT_RECONNECT
var conn = mysql_libmysqlclient.createConnectionSync();
conn.initSync();
conn.setOptionSync(conn.MYSQL_OPT_RECONNECT, 1);
conn.realConnectSync(cfg.host, cfg.user, cfg.password);
From d4c7910b800fb5d521b9b870ee396a858e1d01b5 Mon Sep 17 00:00:00 2001
From: Oleg Efimov <efimovov@gmail.com>
Date: Wed, 2 Feb 2011 16:19:48 +0300
Subject: [PATCH] Fix wrong gmt_delta calculation in datetime casting, closes #72
---
src/mysql_bindings_result.cc | 20 ++++++++++++++++----
tests/complex/test-datatypes-cast.js | 32 ++++++++++++++++++++++++--------
2 files changed, 40 insertions(+), 12 deletions(-)
@Sannis
Sannis / AK-LABSharpen.scm
Created February 24, 2011 00:32
This script does LAB sharpening in GIMP using the unsharp mask.
;
; LAB Sharpen, v. 1.0
;
; Adam Kemp (gimp@adamkemp.com)
; (C) 2009
;
; This script does LAB sharpening in GIMP using the unsharp mask. The steps it automates are:
; 1. Decompose the image into LAB
; 2. Run the unsharp mask filter on the Luminance (L) layer using the supplied settings.
; 3. Recompose the image from the LAB image
// Copyright 2009 Ryan Dahl <ry@tinyclouds.org>
#include <v8.h>
#include <node.h>
#include <node_os.h>
#include <sys/types.h>
#include <sys/time.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
@Sannis
Sannis / LICENSE.txt
Created May 16, 2011 16:24 — forked from jed/LICENSE.txt
calculate # of ms/seconds/minutes/hours/days in the past
Copyright (c) 2011 Jed Schmidt, http://jed.is
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
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@Sannis
Sannis / json-protocol.js
Created December 7, 2011 09:24 — forked from joekim/json-protocol.js
A simple carriage-return, line-feed delimited JSON protocol.
/*
A simple carriage-return, line-feed delimited JSON protocol.
Receiving Usage:
protocol = require('./json-protocol');
// parsing data
parser = protocol.StreamParser();
SELECT * FROM table WHERE price = (SELECT MAX(price) FROM table);
vs
SELECT * FROM table ORDER BY price DESC LIMIT 1;
@Sannis
Sannis / screencast.sh
Created March 15, 2012 21:22 — forked from pomeo/screencast.sh
script to make screencasts on Linux
#!/bin/bash
# list of programs we depend on
progs="xdpyinfo grep head sed ffmpeg pacat parec sox"
# check for programs we depend on
result=0
for prog in $progs
do
type -p $prog > /dev/null
@Sannis
Sannis / wtf_wikipedia_anchors.js
Created May 11, 2012 15:57
WTF Wikipedia anchors encoding
// Wikipedia link cleanup
(function (wpl) {
if (wpl) {
function decodeWikiURL(link) {
function deChar(ss) {
return decodeURIComponent(ss.replace(/\.([0-9A-F][0-9A-F])/g, '%$1'));
}
function deChar2(hhh) {
var ch = deChar(hhh);
sannis@Oleg-Efimovs-MacBook-Pro: nodejs $ uname -a
Darwin Oleg-Efimovs-MacBook-Pro.local 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr 9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64
sannis@Oleg-Efimovs-MacBook-Pro: nodejs $ node -v
v0.6.17
sannis@Oleg-Efimovs-MacBook-Pro: nodejs $ npm -v
1.1.21