Skip to content

Instantly share code, notes, and snippets.


Harish Karumuthil harish2704

View GitHub Profile
mizzy / node-simple-proxy.js
Created November 6, 2011 09:07
Simple proxy made by node.js
View node-simple-proxy.js
var http = require('http');
var url = require('url');
var proxy = http.createServer(function(req, res) {
var request = url.parse(req.url);
options = {
host: request.hostname,
port: request.port || 80,
path: request.path,
method: req.method,
TooTallNate / repl-client.js
Created March 26, 2012 20:09
Running a "full-featured" REPL using a net.Server and net.Socket
View repl-client.js
var net = require('net')
var sock = net.connect(1337)
sock.on('connect', function () {
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
View gist:2999707
<!doctype html>
<title>Site Maintenance</title>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
willurd /
Last active June 6, 2023 00:33
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
sindresorhus / post-merge
Last active March 13, 2023 11:13
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
View post-merge
#!/usr/bin/env bash
# MIT © Sindre Sorhus -
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
NickBeeuwsaert / printElement.js
Last active March 22, 2017 06:38
This is a chrome snippet to take a screenshot of a element
View printElement.js
* NOTE: Because Chrome doesn't elevate the permissions
* of snippets, we can't push the image out to the browser
* using canvas.toDataURL(), we have to add it to the page
* and have the user right-click and save-as
var css = function(el, styles){
for (var style in styles) {
if(!styles.hasOwnProperty(style)) continue;[style] = styles[style];
rmehner / delete-databases.js
Last active April 2, 2023 16:31
Delete all indexedDB databases
View delete-databases.js
// Credit to @steobrien from
// for modern browsers, this works:
const dbs = await window.indexedDB.databases()
dbs.forEach(db => { window.indexedDB.deleteDatabase( })
// for older browsers, have a look at previous revisions of this gist.
RedactedProfile / routes:index.js
Last active January 11, 2023 17:51
CKEditor File Upload with Node and Express
View routes:index.js
var express = require('express');
var router = express.Router();
var multipart = require('connect-multiparty');
var multipartMiddleware = multipart();
router.get('/', function(req, res) {
creationix / init.lua
Last active November 1, 2019 11:13
Websocket server in nodemcu using new crypto module.
View init.lua
tmr.alarm(0, 1000, 1, function ()
local ip = wifi.sta.getip()
if ip then
darkxanter /
Last active April 21, 2018 09:15
Python DBus handle hibernate, sleep and resume
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'xanter'
#from datetime import datetime
import signal
import time
import dbus
import gobject
import urllib2