Skip to content

Instantly share code, notes, and snippets.

@guileen
guileen / _service.md
Last active September 28, 2016 09:14 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@guileen
guileen / XXTea.cs
Last active August 29, 2015 14:16 — forked from lski/XXTea.cs
using System;
using System.Text;
/// <summary>
/// A class for encrypting and decrypting a string into base64 format which makes it safe for transfer
/// between applications.
///
/// Reference:
/// Based upon the javascript implementation of xxtea by: Chris Veness
/// www.movable-type.co.uk/tea-block.html
@guileen
guileen / chat.go
Last active August 29, 2015 14:13
package main
import (
"bufio"
"net"
)
type Client struct {
incoming chan string
outgoing chan string
@guileen
guileen / supervisor.sh
Last active August 29, 2015 13:56 — forked from keimlink/gist:831633
/etc/init.d/supervisord
#!/bin/sh
#
# /etc/rc.d/init.d/supervisord
#
# Supervisor is a client/server system that
# allows its users to monitor and control a
# number of processes on UNIX-like operating
# systems.
#
# chkconfig: - 64 36

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

@guileen
guileen / monitrc
Created January 25, 2013 15:02 — forked from metakeule/monitrc
# /etc/monit/monitrc (excerpt)
check process node-app with pidfile /var/run/node-app.pid
start program = "/sbin/start node-app" with timeout 5 seconds
stop program = "/sbin/stop node-app"
if failed port 3000 protocol HTTP
request /
with timeout 3 seconds
then restart
if cpu > 80% for 10 cycles then restart
import re
import json
import urllib
import base64
import hashlib
import requests
WBCLIENT = 'ssologin.js(v.1.3.18)'
sha1 = lambda x: hashlib.sha1(x).hexdigest()
@guileen
guileen / nginx.conf
Created July 24, 2012 05:09 — forked from srpouyet/nginx.conf
Nginx Upstart script (Ubuntu 12.04)
### Nginx upstart script
### source: http://serverfault.com/a/391737/70451
### /etc/init/nginx.conf
description "nginx http daemon"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
env DAEMON=/opt/nginx/sbin/nginx
@guileen
guileen / StackScript.sh
Created April 5, 2012 19:23 — forked from visnup/StackScript.sh
node.js knockout 2011 StackScript
#!/bin/bash
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# <UDF name="ssh_key" Label="Paste in your public SSH key" default="" example="" optional="false" />
# root ssh keys
mkdir /root/.ssh
echo $SSH_KEY >> /root/.ssh/authorized_keys
chmod 0700 /root/.ssh
@guileen
guileen / gist:949739
Created April 30, 2011 15:13 — forked from kennethkalmer/gist:278814
node.js SMTP Server
/*
smtpd.js is SMTP server written for node.js
MIT License
*/
var tcp = require('tcp');
var sys = require('sys');