Skip to content

Instantly share code, notes, and snippets.

@endolith
endolith / Has weird right-to-left characters.txt
Last active October 26, 2024 13:55
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@FrankGrimm
FrankGrimm / nodepost-1.js
Created November 9, 2010 15:31
HTTP body in node.js
var http = require('http');
http.createServer(function (req, res) {
// set up some routes
switch(req.url) {
case '/':
console.log("[501] " + req.method + " to " + req.url);
res.writeHead(501, "Not implemented", {'Content-Type': 'text/html'});
res.end('<html><head><title>501 - Not implemented</title></head><body><h1>Not implemented!</h1></body></html>');
break;
import sys
import socket
HOST, PORT = "127.0.0.1", 9999
data = " ".join(sys.argv[1:])
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((HOST, PORT))
sock.send(data + "\n")
@dotmaster
dotmaster / gist:726802
Created December 3, 2010 10:23
hijacking Javascript console.log revamped with StackTrace (just Google Chrome)
// usage as usual: console.log('inside coolFunc',this,arguments);
if (typeof console !== "undefined") {
console.logJack = console.log;
window.log={}
window.log.history = window.log.history || {}; // store logs to a global history for reference
console.log=function(){
var timestamp= (new Date); //create a timestamp of the log
var millis=timestamp.getTime();
var readableString=timestamp.toUTCString();
@Marak
Marak / base64.js
Created February 8, 2011 00:41
An extremely simple implementation of base64 encoding / decoding using node.js Buffers
/*
* base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers
*
* (C) 2010, Nodejitsu Inc.
*
*/
var base64 = exports;
base64.encode = function (unencoded) {
@Floby
Floby / gist:850083
Created March 1, 2011 22:58
To know who exactly is on the internet. within the IPv4 address space...
#!/usr/bin/env node
var cp = require('child_process');
var sys = require ('sys')
var fs = require ('fs')
var lines = require ('lines')
var nextAddress;
var i=1, j=1, k=1;
nextAddress = function() {
++k;
@indexzero
indexzero / round-robin-proxy.js
Created March 14, 2011 20:15
A simple example of how to do round-robin proxying for a single domain
var httpProxy = require('http-proxy');
//
// Addresses to use in the round robin proxy
//
var addresses = [
{
host: 'ws1.0.0.0',
port: 80
},
@robrighter
robrighter / gist:897565
Created April 1, 2011 00:59
Walk a JSON/Javascript tree to grab all values for a given key
function traverse(obj,func, parent) {
for (i in obj){
func.apply(this,[i,obj[i],parent]);
if (obj[i] instanceof Object && !(obj[i] instanceof Array)) {
traverse(obj[i],func, i);
}
}
}
function getPropertyRecursive(obj, property){
@mcantelon
mcantelon / Mongoose example
Created April 1, 2011 05:15
Mongoose example
// from Horofox in #node.js
var mongoose = require('mongoose');
var db = mongoose.connect('mongodb://localhost/mydb');
function allowPosts(mongoose) {
var Schema = mongoose.Schema;
var Posts = new Schema({
name : String,
subject: String,
comment : String,
@Floby
Floby / editor.js
Created April 19, 2011 09:18
open the default editor from node
var fs = require('fs');
var child_process = require('child_process');
var spawn = child_process.spawn;
function openEditor(file) {
var cp = spawn(process.env.EDITOR, [file], {
customFds: [
process.stdin,
process.stdout,
process.stderr