Skip to content

Instantly share code, notes, and snippets.

[program:mongod]
autostart=true
command=/usr/bin/mongod -f /etc/mongod.conf
user=mongod
log_stderr=true
log_stdout=true
logfile=/var/log/mongo/mongod.log
stdout_logfile=/var/log/mongo/mongod.log
stderr_logfile=/var/log/mongo/mongod.log
stopsignal=2
@rdkls
rdkls / convert_mp3.py
Last active May 3, 2021 13:28
python script to recursively convert all files in a source directory to a target directory using ffmpeg
#!/usr/bin/python
import os
import pprint
import subprocess
src_dir = '/Volumes/Untitled CD'
dst_dir = '/tmp/cd'
for root, dirs, files in os.walk(src_dir):
for f in files:
@rdkls
rdkls / tampermonkey_trello_list_num_cards_show
Last active December 16, 2015 12:18
Tampermonkey script to show the number of cards in each Trello list Turns out it's already there, just need to set display = block
// ==UserScript==
// @name Trello Lists Show Num Cards
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match https://trello.com/board/*
// @copyright 2012+, You
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js
// ==/UserScript==
setTimeout(function() {
@rdkls
rdkls / django_app_root_include_snippet
Last active December 16, 2015 15:49
django settings.py code to include apps dir
import os
import sys
PROJECT_ROOT = os.path.dirname(__file__)
sys.path.append(os.path.join(PROJECT_ROOT, "apps")
@rdkls
rdkls / bw_usage.sh
Last active December 24, 2015 15:39
Shell script to display an interface's bandwidth usage (Tx/Rx) every second
#!/bin/bash
secs=1
interface=eth0
echo "Displaying bandwidth on $interface every $secs seconds, ctrl-c to stop"
rx_bytes_prev=`ifconfig eth1|grep 'RX bytes'| sed -n 's/^\s*RX bytes:\([0-9]*\).*/\1/p'`
tx_bytes_prev=`ifconfig eth1|grep 'TX bytes'| sed -n 's/.*TX bytes:\([0-9]*\).*/\1/p'`
while [ true ] ; do
sleep $secs
rx_bytes=`ifconfig eth1|grep 'RX bytes'| sed -n 's/^\s*RX bytes:\([0-9]*\).*/\1/p'`
tx_bytes=`ifconfig eth1|grep 'TX bytes'| sed -n 's/.*TX bytes:\([0-9]*\).*/\1/p'`
@rdkls
rdkls / segment_variant.sh
Created October 11, 2013 09:38
ffmpeg command to product segmented variant m3u8 playlist
#!/bin/bash
basename=/mnt/warehouse/grouch_core/live/grouch_ramdisk
mkdir -p $basename/$1
(
cd $basename/$1
/usr/local/bin/ffmpeg -i rtmp://172.16.1.14/publish/$1 \
-acodec copy \
-f segment \
-flags -global_header \
-map 0 \
@rdkls
rdkls / gtw.php
Created November 12, 2013 00:53
WordPress Plugin Malware after our site was compromised. Appears it used to be on the wordpress plugins site(!) http://wordpress.org/support/view/plugin-reviews/gtw With comments warning of spyware.
<?php
/*
Plugin Name: gtw
Description: Makes your website multilingual and available to the world using Google Translate. Please use <a href="http://gtranslate.net/forum/">GTranslate Forum</a> for your support requests.
Version: 1.0.3
Author: vendetta5
*/
/* Copyright 2008 - 2013 GTranslate (email : info [] gtranslate.net)
{{EPOLLIN, {u32=36974464, u64=36974464}}}, 512, 4294967295) = 1
accept4(11, {sa_family=AF_INET, sin_port=htons(37878), sin_addr=inet_addr("5.6.7.8")}, [16], SOCK_NONBLOCK) = 13
recvfrom(13, 0x2333d60, 1537, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
epoll_ctl(4, EPOLL_CTL_ADD, 13, {EPOLLIN|EPOLLET|0x2000, {u32=36974656, u64=36974656}}) = 0
epoll_wait(4, {{EPOLLIN, {u32=36974656, u64=36974656}}}, 512, 60000) = 1
{{EPOLLIN, {u32=11853760, u64=11853760}}}, 512, 4294967295) = 1
accept4(11, {sa_family=AF_INET, sin_port=htons(37377), sin_addr=inet_addr("9.10.11.12")}, [16], SOCK_NONBLOCK) = 13
recvfrom(13, 0xb3eda0, 1537, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
epoll_ctl(4, EPOLL_CTL_ADD, 13, {EPOLLIN|EPOLLET|0x2000, {u32=11853952, u64=11853952}}) = 0
epoll_wait(4, {{EPOLLIN, {u32=11853952, u64=11853952}}}, 512, 60000) = 1
@rdkls
rdkls / Nginx RTMP publish from Envivio - Tshark
Last active December 31, 2015 05:18
1.2.3.4 = Nginx + RTMP, 5.6.7.8 = Envivio
5.200645 5.6.7.8 -> 1.2.3.4 TCP 62 50167 > macromedia-fcs [SYN] Seq=0 Win=65535 Len=0 MSS=1387 SACK_PERM=1
5.200693 1.2.3.4 -> 5.6.7.8 TCP 62 macromedia-fcs > 50167 [SYN, ACK] Seq=0 Ack=1 Win=14600 Len=0 MSS=1460 SACK_PERM=1
5.202309 5.6.7.8 -> 1.2.3.4 TCP 60 50167 > macromedia-fcs [ACK] Seq=1 Ack=1 Win=65535 Len=0
5.203068 5.6.7.8 -> 1.2.3.4 RTMP 1591 Handshake C0+C1
5.203087 1.2.3.4 -> 5.6.7.8 TCP 54 macromedia-fcs > 50167 [ACK] Seq=1 Ack=1538 Win=16644 Len=0
5.203208 1.2.3.4 -> 5.6.7.8 TCP 1441 macromedia-fcs > 50167 [ACK] Seq=1 Ack=1538 Win=16644 Len=1387
5.203219 1.2.3.4 -> 5.6.7.8 TCP 204 macromedia-fcs > 50167 [PSH, ACK] Seq=1388 Ack=1538 Win=16644 Len=150
5.203257 1.2.3.4 -> 5.6.7.8 TCP 1441 macromedia-fcs > 50167 [ACK] Seq=1538 Ack=1538 Win=16644 Len=1387
5.205309 5.6.7.8 -> 1.2.3.4 TCP 60 50167 > macromedia-fcs [ACK] Seq=1538 Ack=1538 Win=65535 Len=0
5.205325 1.2.3.4 -> 5.6.7.8 RTMP 203 Handshake S0+S1+S2