Skip to content

Instantly share code, notes, and snippets.

View dagelf's full-sized avatar

Coenraad Loubser dagelf

View GitHub Profile
@xenomuta
xenomuta / cdr_fijo_mongodb.js
Created March 15, 2012 04:48
Asterisk CDR with NodeJS and MongoDB
/*
cdr_fifo_mongodb: A quick and dirty hack that consists of configuring asterisk’s
cdr_custom.conf to write to a named pipe, which will be then read by node and
then written into mongodb.
good alternative to cdr_mongodb, 'cause I couldn't make it work stable for 1.8
*/
var config = {
"dburl": "asterisk", /* user:pass@host/db */
"collections": ["cdr"],
"fifo": "/var/log/asterisk/cdr-custom/cdr_fifo.csv",
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@christianberg
christianberg / Dockerfile
Last active January 10, 2023 16:58
Sharing a unix socket between a Docker container and it's host
FROM ubuntu
RUN apt-get update
RUN apt-get install -y socat
VOLUME /foo
CMD socat UNIX-LISTEN:/foo/bar.sock -
@moderation
moderation / mesos_arm.md
Last active March 21, 2016 11:25
Compile Apache Mesos 0.22 for Raspberry Pi 2

How to compile Mesos on your new Raspberry Pi 2 (which is amazing with 4 cores and 6x performance). Follows on from experiments in compiling for OS X

sudo apt-get install maven libsasl2-dev libapr1-dev libsvn-dev libcurl4-openssl-dev python-dev python-boto

export JAVA_HOME="/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt"
export PATH=$JAVA_HOME/bin:$PATH

http://likemagicappears.com/projects/raspberry-pi-cluster/mesos-on-raspbian/

progrium/bashstyle

Bash is the JavaScript of systems programming. Although in some cases it's better to use a systems language like C or Go, Bash is an ideal systems language for smaller POSIX-oriented or command line tasks. Here's three quick reasons why:

  • It's everywhere. Like JavaScript for the web, Bash is already there ready for systems programming.
  • It's neutral. Unlike Ruby, Python, JavaScript, or PHP, Bash offends equally across all communities. ;)
  • It's made to be glue. Write complex parts in C or Go (or whatever!), and glue them together with Bash.

This document is how I write Bash and how I'd like collaborators to write Bash with me in my open source projects. It's based on a lot of experience and time collecting best practices. Most of them come from these two articles, but here integrated, slightly modified, and focusing on the most bang for buck items. Plus some ne

@hu55a1n1
hu55a1n1 / miniupnp_port_forwarder.c
Created October 28, 2016 18:59
Port forwarder using miniupnp library
/* $Id: upnpc.c,v 1.101 2014/01/31 13:18:25 nanard Exp $ */
/* Project : miniupnp
MiniUPnPc
Copyright (c) 2005-2016, Thomas BERNARD
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
@jexp
jexp / ms-concepts-import.sh
Created November 4, 2016 02:32
Load and query the Microsoft Concept Graph in Neo4j https://concept.research.microsoft.com/Home/Introduction
function import_extract_first {
echo "name:ID(Concept)" > concepts.txt
cat data-concept-instance-relations.txt | cut -d $'\t' -f 1 | sort | uniq >> concepts.txt
echo "name:ID(Instance)" > instances.txt
cat data-concept-instance-relations.txt | cut -d $'\t' -f 2 | sort | uniq >> instances.txt
echo $':END_ID(Concept)\t:START_ID(Instance) relations:int' > is_a.hdr
$NEO4J_HOME/bin/neo4j-import --into concepts.db --id-type string --delimiter TAB --bad-tolerance 13000000 --skip-duplicate-nodes true --skip-bad-relationships true \
@fnordbar
fnordbar / traffic.sh
Last active May 23, 2018 17:07 — forked from radu-gheorghe/traffic.sh
bash script for checking out traffic via /proc/net/dev
#!/bin/bash
#shows traffic on the specified device
function human_readable {
VALUE=$1
BIGGIFIERS=( B K M G )
CURRENT_BIGGIFIER=0
while [ $VALUE -gt 10000 ] ;do
VALUE=$(($VALUE/1000))
@hu55a1n1
hu55a1n1 / grandstream-configurator.php
Created December 23, 2017 12:36
CLI tool for automatic discovery and bulk provisioning of Grandstream IP phones
<?php
function to_str($obj) {
ob_start();
var_dump($obj);
return ob_get_clean();
}
function str_btw($string, $start, $end){
$string = ' ' . $string;
@danitool
danitool / broadcom_wl-WDS.txt
Created November 29, 2018 14:41
commands to configure the broadcom propietary driver in WDS pure bridge mode (no stations allowed)
-- remove the driver to clean up --
wlctl -i wl0 down
rmmod wl
insmod wl
-- set WPA2-AES encryption --
wlctl -i wl0 wsec 4
wlctl -i wl0 wpa_auth 128
wlctl -i wl0 wsec_restrict 1
wlctl -i wl0 eap 0