Skip to content

Instantly share code, notes, and snippets.

View literadix's full-sized avatar
💭
I may be slow to respond.

literadix

💭
I may be slow to respond.
View GitHub Profile
@literadix
literadix / RxZipper.js
Created November 25, 2015 12:59 — forked from alanmquach/RxZipper.js
RxJS equivalent of async.parallel
var Rx = require('rx');
var zipper = function () {
// Turning arguments from an object into an actual array so we can use things like map()
return Array.prototype.slice.call(arguments);
};
var array; // Given some array of Observables that you want zipped together
// Or the more classical case where given an array of data to operate on, simply map them into observables
@startuml
abstract class Mixinproxy
interface InterfaceOne
interface InterfaceTwo
interface InterfaceBoth
ClassOne <|-- InterfaceOne
ClassTwo <|-- InterfaceTwo
InterfaceBoth <|-- InterfaceOne
@literadix
literadix / http-benchmark.md
Created December 6, 2016 09:39 — forked from denji/http-benchmark.md
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)

Tools

Located in alphabetical order (not prefer)

  • ab – slow and single threaded, written in C
  • apib – most of the features of ApacheBench (ab), also designed as a more modern replacement, written in C
  • baloo – Expressive end-to-end HTTP API testing made easy, written in Go (golang)
  • bombardier – Fast crossplatform HTTP benchmarking tool, written in Go (golang)
  • curl-loader – performance loading of various application services and traffic generation, written in C
  • gatling – High performance load testing framework based on Scala, Akka and Netty, write in Scala
@literadix
literadix / sample_haproxy.conf
Created December 8, 2017 14:58
Example configuration to log all http request (with post body)
global
log 127.0.0.1 local0
user root
group root
daemon
defaults
log global
mode http
option httplog
@literadix
literadix / rawsocket_example.py
Last active December 15, 2017 09:13
Example how to send a raw socket message from python (BSD style)
import socket
import struct
def make_ip(proto, srcip, dstip, ident=54321):
saddr = socket.inet_aton(srcip)
daddr = socket.inet_aton(dstip)
ihl_ver = (4 << 4) | 5
return struct.pack('!BBHHHBBH4s4s' , ihl_ver, 0, 0, ident, 0, 255, proto, 0, saddr, daddr)
def make_tcp(srcport, dstport, payload, seq=123, ackseq=0, fin=False, syn=True, rst=False, psh=False, ack=False, urg=False, window=5840):
import pip
installed_packages = pip.get_installed_distributions()
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
for i in installed_packages])
print(installed_packages_list)
will print
[
'alembic==0.9.6', 'asn1crypto==0.22.0', 'beautifulsoup4==4.5.3', 'bleach==2.0.0',
@literadix
literadix / parse_hex_rust.rs
Last active May 18, 2018 08:30
Parse hex value from command line arguments in rust
// For Masud
use std::env;
fn main() {
let args: Vec<String> = env::args().collect();
match args.len() {
2 => {
@literadix
literadix / playground.rs
Created May 22, 2018 08:54 — forked from rust-play/playground.rs
Code shared from the Rust Playground
extern crate num;
use num::bigint::BigInt;
fn main() {
match "123123123123123123123".parse::<BigInt>() {
Ok(n) => println!("{}", n),
Err(_) => println!("Error")
}
package main
import (
"github.com/go-redis/redis"
"fmt"
"time"
)
func ExampleNewClient() {
client := redis.NewClient(&redis.Options{
@literadix
literadix / install-redis.md
Created September 6, 2018 10:59 — forked from hackedunit/install-redis.md
Install and configure Redis on Ubuntu 16.04 with systemd
  1. Install pre-requisities

sudo apt-get install build-essential tcl

  1. Install Redis
cd /tmp
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz