Skip to content

Instantly share code, notes, and snippets.

View abdul's full-sized avatar
🎯
Focusing

Abdul Qabiz abdul

🎯
Focusing
View GitHub Profile
@tessro
tessro / redis-server
Created December 16, 2009 14:20
A CentOS initscript for Redis
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
@defunkt
defunkt / installing-mustache.vim.md
Created March 6, 2010 10:21
Installing mustache.vim

mustache.vim

In your shell:

cd ~/.vim
git clone git://github.com/juvenn/mustache.vim.git
mv mustache.vim/syntax/* syntax/
mv mustache.vim/indent/* indent/
mv mustache.vim/ftdetect/* ftdetect/

rm -rf mustache.vim

@dscape
dscape / export-twitter-favorites-to-delicious.xqy
Created April 30, 2010 07:04
Export your twitter favorites links (includes redirects, page titles and suggested tags) to delicious with #MarkLogic
xquery version "1.0-ml";
declare variable $twitter-username as xs:string external;
declare variable $delicious-username as xs:string external;
declare variable $delicious-password as xs:string external;
declare function local:get-favorite-page($username,$page) {
xdmp:http-get(
fn:concat(
"http://api.twitter.com/1/favorites/",$username,".xml?page=",$page))[2] };
#!/bin/bash
#updated ffmpeg progress indicator
#by Rupert Plumridge
#for updates visit www.prupert.co.uk
#Creative Commons Attribution-Non-Commercial-Share Alike 2.0 UK: England & Wales Licence
# Based on the ffmpegprogress bar from: http://handybashscripts.blogspot.com/2011/01/ffmpeg-with-progress-bar-re-work.html
# which was based on my initital progress script - circle of life and all that ;)
# version 2.0
# 07.04.2011
# now uses apparently better progress detection, based on duration of overall video and progress along the conversion
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active July 21, 2024 01:20
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@nicholasjconn
nicholasjconn / gist:753207
Created December 23, 2010 16:26
NJS's MSP430 LaunchPad Oscilloscope
/******************************************************************************
* NJS's MSP430 LaunchPad Oscilloscope
*
* Description: This code turns the launchpad into a simple (slow)
* oscilloscope using a bi-directional software UART.
* The MCU will accept ascii commands from the computer
* for single measurment of a channel (internal and
* external) and also continous measuring of external
* channels.
*
@octplane
octplane / net_http_write_timeout.rb
Created January 26, 2011 08:24
enforce a 3s timeout when writing to the network, monkey-patch against 1.8 ruby net/http
module Net
class HTTP < Protocol
def connect
D "opening connection to #{conn_address()}..."
s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) }
D "opened"
if use_ssl?
unless @ssl_context.verify_mode
warn "warning: peer certificate won't be verified in this SSL session"
@gnomet
gnomet / Sharetribe DB installation
Created January 31, 2011 16:32
Running these commands in MySQL will create three databases where the user "sharetribe" has access. DON'T FORGET TO CHANGE ALL THE put_a_password_here PARTS TO A SECURE PASSWORD!
CREATE DATABASE sharetribe_test CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE DATABASE sharetribe_development CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE DATABASE sharetribe_production CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT all privileges ON sharetribe_development.* TO 'sharetribe'@'localhost' IDENTIFIED BY 'put_a_password_here';
GRANT all privileges ON sharetribe_production.* TO 'sharetribe'@'localhost' IDENTIFIED BY 'put_a_password_here';
GRANT all privileges ON sharetribe_test.* TO 'sharetribe'@'localhost' IDENTIFIED BY 'put_a_password_here';
@nilcolor
nilcolor / Node.js CORS
Created February 8, 2011 15:28
Node.js cross-origin POST. You should response for OPTIONS request first. Something like this.
if (req.method === 'OPTIONS') {
console.log('!OPTIONS');
var headers = {};
// IE8 does not allow domains to be specified, just the *
// headers["Access-Control-Allow-Origin"] = req.headers.origin;
headers["Access-Control-Allow-Origin"] = "*";
headers["Access-Control-Allow-Methods"] = "POST, GET, PUT, DELETE, OPTIONS";
headers["Access-Control-Allow-Credentials"] = false;
headers["Access-Control-Max-Age"] = '86400'; // 24 hours
headers["Access-Control-Allow-Headers"] = "X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept";
@zefer
zefer / nginx_cors_s3_upload_proxy_full
Created February 18, 2011 13:29
My nginx config to allow CORS (cross-site) uploads to Amazon S3, with added config e.g. timeouts & security
# DO NOT RESPOND TO REQUESTS OTHER THAN yourdomain.com
server {
listen 80 default;
server_name _;
return 444;
}
# FILE UPLOADS
server {
listen 80;