Skip to content

Instantly share code, notes, and snippets.

View thomasbhatia's full-sized avatar

Thomas Bhatia thomasbhatia

View GitHub Profile
@thomasbhatia
thomasbhatia / qos-opendpi.sh
Created July 22, 2012 20:45 — forked from nacx/qos-opendpi.sh
Basic QoS with iproute2 and OpenDPI Netfilter wrapper
#!/bin/bash
# Basic QoS script that uses OpenDPI (http://www.opendpi.org/)
# Netfilter wrapper to identify packets by the protocol.
#
# This script enqueues packets in three queues, each one
# with a different priority:
#
# The first queue has the higher priority and gets the TCP SYN
# packets, ACKs, ICMPs and packets with Minimize-Delay TOS.
@thomasbhatia
thomasbhatia / scapy_layer-_gtp.py
Created December 5, 2012 11:33
Scapy layer: GTP
## This file is not now part of Scapy
## Look iniqua.com for more informations
## ffranz <ffranz@iniqua.com>
## This program is published under a GPLv2 license
import time
import logging
from scapy.packet import *
from scapy.fields import *
%% @author Masahito Ikuta <cooldaemon@gmail.com> [http://d.hatena.ne.jp/cooldaemon/]
%% @copyright Masahito Ikuta 2008
%% @doc UDP Server Behaviour.
%% Copyright 2008 Masahito Ikuta
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
#!/bin/bash
# As the "bufferbloat" folks have recently re-discovered and/or more widely
# publicized, congestion avoidance algorithms (such as those found in TCP) do
# a great job of allowing network endpoints to negotiate transfer rates that
# maximize a link's bandwidth usage without unduly penalizing any particular
# stream. This allows bulk transfer streams to use the maximum available
# bandwidth without affecting the latency of non-bulk (e.g. interactive)
# streams.
def to_tbcd(binary_string):
"""
tbcd decoding in one line
function takes argument in a form "0b10110101001" and translates it into a string
presentation of integer by tbcd standards
http://en.wikipedia.org/wiki/Binary-coded_decimal#Telephony_Binary_Coded_Decimal_.28TBCD.29
"""
return "".join(str(int(binary_string[index: index + 4], 2)) if int(binary_string[index + 4:index + 8], 2) == 15 else "%s%s" % (int(binary_string[index + 4:index + 8], 2), int(binary_string[index: index + 4], 2)) for index in range(2, len(binary_string), 8))

Summary

I'm trying to figure out how to use rebar to:

  • create erlang project
  • add a dependency on an erlang module from github
  • start the app via the erl console
  • create a release and start the app from the release (via the generated scripts)
#!/bin/bash
# Install fake erlang packages, then the ESL package
# Afterwards, installing packages that depend on erlang, like rabbitmq,
# will use the ESL packaged erlang without installing the older disto ones
#
apt-get install equivs
# Create fake erlang packages, since we are using esl-erlang instead
cd /tmp
apt-get install -y equivs
1.CentOS 6.3
#yum install make gcc
#cd /opt
$wget http://redis.googlecode.com/files/redis-2.x.xx.tar.gz
$tar zxf redis-2.x.xx.tar.gz
$cd redis-2.x.xx
$make
$make install
//////
#!/bin/sh
# http://vm-192-168-11-21.shengyun.grandcloud.cn/topics/2437
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
# my copy redis.conf
# changes
# 1. dir
# 2. daemonize yes
# 3. maxmenory 100MB
# 4. logfile /var/log/redis.log
#
#
# Redis configuration file example
#