Skip to content

Instantly share code, notes, and snippets.

@gotomypc
gotomypc / redis_mysql_dump.js
Created November 10, 2012 14:51 — forked from m0llysour/redis_mysql_dump.js
Redis to MySQL dump
// modules
var redis = require('redis');
var Step = require('step');
// config file
var config = require('config');
// mysql client connect
var mysql = require('mysql');
var connection = mysql.createConnection({
@gotomypc
gotomypc / Websocket-speed-test.js
Created November 4, 2012 14:20 — forked from NHQ/Websocket-speed-test.js
Test how fast your browser handles websockets with Node.js.
var server = require( 'http' ).createServer();
// our html template
var script = function( f ) {
// get just the content of this script
var s = /^[^\{]+\{\n?([\s\S]+)\}/.exec( f )[1];
return [
'<!DOCTYPE html><html>',
'<head>',
'<script type="text/javascript">',s,'</script>',
'use strict';
/*
# Javascript Prototyping Best Practices
* To create a class, create a constructor function with a `Name` and assign
it to a variable of the same `Name`.
* In this constructor only define properties using `this.prop` notation
@gotomypc
gotomypc / GoDaddySSLHAProxy.md
Created October 7, 2016 06:00 — forked from sethwebster/GoDaddySSLHAProxy.md
Creating a PEM for HaProxy from GoDaddy SSL Certificate

GoDaddy SSL Certificates PEM Creation for HaProxy (Ubuntu 14.04)

1 Acquire your SSL Certificate

Generate your CSR This generates a unique private key, skip this if you already have one.

sudo openssl genrsa -out  etc/ssl/yourdomain.com/yourdomain.com.key 1024

Next generate your CSR (Certificate Signing Request), required by GoDaddy:

@gotomypc
gotomypc / Twelve_Go_Best_Practices.md
Created February 2, 2016 16:10 — forked from pzurek/Twelve_Go_Best_Practices.md
Twelve Go Best Practices
package org.springframework.samples.mvc.fileupload;
import java.io.IOException;
import org.springframework.mvc.extensions.ajax.AjaxUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
// ==UserScript==
// @name Tfocus
// @namespace http://efcl.info/
// @include http://*
// @include https://*
// @require https://github.com/hatena/extract-content-javascript/raw/master/lib/extract-content-all.js
// ==/UserScript==
(function(_doc) {
// DEBUG ON/OFF
var DEBUG = true;
// Minimal audio streaming using OpenSL.
//
// Loosely based on the Android NDK sample code.
// Hardcoded to 44.1kHz stereo 16-bit audio, because as far as I'm concerned,
// that's the only format that makes any sense.
#include <assert.h>
#include <string.h>
// for native audio
@gotomypc
gotomypc / pinterest.js
Created February 25, 2013 06:42 — forked from 65/pinterest.js
$().ready(function() {
$('.entry-body img').each(function(){
var $permalink = $(this).parents('.entry').find('.permalink').attr('href');
$(this).wrap('<div class="pinme" style="' + $(this).attr('style') + '" />').after('<a href="http://pinterest.com/pin/create/button/?url=' + $permalink + '&media=' + $(this).attr('src') + '&description=' + $(this).attr('alt') + '" class="pin-it-button" count-layout="vertical">Pin It</a>');
});
$('.pinme').hover(function() {
$(this).children('iframe').css('display','block');
}, function() {
$(this).children('iframe').css('display','none');
http = require('http');
fs = require('fs');
fd = fs.openSync(__filename, 'r');
size = fs.fstatSync(fd).size;
server = http.createServer(function(req, res) {
res.writeHead(200, {
'Content-Length': size,
'Content-Type': 'text/plain'