This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
from https://gist.github.com/JoeGermuska/561347 | |
Like cut, but for CSVs. To be used from a shell command line. | |
Note that fields are 1-based, similar to the UNIX 'cut' command. | |
Should use something better than getopt, but this works... | |
Usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ************************************** | |
Weekly Update Scripts | |
by Dan Brown, March 2013 | |
For automatic collection of weekly | |
update messages from employees. | |
* sends reminder messages | |
* posts to public sites pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Lua routines for use inside the Redis datastore | |
# Hyperloglog cardinality estimation | |
# ported from http://stackoverflow.com/questions/5990713/loglog-algorithm-for-counting-of-large-cardinalities | |
# | |
# Dan Brown, 2012. https://github.com/dbro | |
# | |
# note that lua needs to have the bitlib and murmur3 modules built in, and loaded by redis | |
# | |
# suitable for counting unique items from 0 to billions | |
# choose a k value to balance storage and precision objectives |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/awk -f | |
BEGIN { | |
hextab["0"] = 0; hextab["8"] = 8; | |
hextab["1"] = 1; hextab["9"] = 9; | |
hextab["2"] = 2; hextab["A"] = 10; hextab["a"] = 10; | |
hextab["3"] = 3; hextab["B"] = 11; hextab["b"] = 11; | |
hextab["4"] = 4; hextab["C"] = 12; hextab["c"] = 12; | |
hextab["5"] = 5; hextab["D"] = 13; hextab["d"] = 13; | |
hextab["6"] = 6; hextab["E"] = 14; hextab["e"] = 14; | |
hextab["7"] = 7; hextab["F"] = 15; hextab["f"] = 15; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/awk -f | |
# input should be a set of numbers, one on each line. can be unsorted. | |
# non-numeric input will be ignored | |
# 2-pass algorithm, stores a copy of each number in an array in memory | |
# this could be changed to assume the input is sorted, but would still | |
# need to know in advance how many numbers to expect in the full set | |
# in order to calculate percentiles and the trimmed mean. | |
BEGIN { | |
FS="\t"; | |
OFS=FS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/awk -f | |
# input should be parallel sets of numbers, one set on each line, tab-separated. | |
# the input does not need to be sorted | |
# non-numeric input anywhere on the line will cause the entire line to be ignored | |
# this uses a naive algorithm that may lose precision in some situations. | |
# see http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance for an alternate algorithm | |
BEGIN { | |
FS="\t"; | |
OFS=FS; | |
n=0; # count of rows (which contain a full set of data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# write the incoming data on stdin to separate files depending on their contents | |
# for example, take a file that has different dates in it: | |
# 2014-02-15+12334567 hello there this is the first line | |
# 2014-02-16+23345678 hello there this is the second line | |
# this file can be used to send the first line to a file called /tmp/session.log-20140215-randomnumber | |
# and the second line to another file called /tmp/session.log-20140214-randomnumber | |
# it takes the first N characters from the line for use in the output filename | |
USAGE="usage: $0 -p \"/tmp/session-logs-ready-to-merge-\" [-s \"-ready-for-merge\" -r -c 10 -d'-'] [input_filename] [another_input_filename] | |
\tp\tprefix path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ash | |
# tested on firmware version 050124.04.00.007 | |
# thanks and credit to https://blog.mellenthin.de/archives/2015/04/29/telekom-speedport-hybrid-logging-mit-rrdtool/comment-page-1/ | |
# note that this script depends on sha256sum which may not be installed in some systems (eg Tomato router). It can be installed using entware/opkg. | |
address="speedport.ip" | |
password="12345678" | |
echo "contacting speedport router at ${address} ..." |