Skip to content

Instantly share code, notes, and snippets.

@sinegar
sinegar / deploy.sh
Last active June 19, 2021 05:09 — forked from jed/deploy.sh
Using AWS CloudFormation to deploy an edge lambda
#!/bin/sh
aws cloudformation deploy \
--template-file stack.yaml \
--stack-name edge-lambda-test \
--capabilities CAPABILITY_IAM \
--parameter-overrides Nonce=$RANDOM
@sinegar
sinegar / csv_encode_test.rb
Last active August 29, 2015 13:56
BBEF CVS import issue
require "test/unit"
require "csv"
class TestCsv < Test::Unit::TestCase
def test_default_utf
csv = "sponsors.csv"
CSV.foreach(csv, :encoding => 'windows-1251:utf-8') do |row|
print row
@sinegar
sinegar / makeapp.sh
Last active August 29, 2015 13:56 — forked from demonbane/makeapp.sh
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"
@sinegar
sinegar / build.sh
Created October 30, 2013 07:53
Build script for buildbox.io which checkout from a private bitbucket repository
#!/bin/bash
# Exits bash immediately if any command fails
set -e
REMOTE_KEY=~/.ssh/builderkey
# Will output commands as the run
set -x
@sinegar
sinegar / Wide.js
Last active August 27, 2018 16:10 — forked from anonymous/gist:4464395
easy fix iStat Pro processes for Mountain Lion
/* source : http://forums.macrumors.com/showpost.php?p=15332289&postcount=20
It's easy to fix iStat Pro processes for Mountain Lion
Steps:
1. Locate your widget, it will be under /Library/Widgets or ~/Library/Widgets
2. Right click it and select: "Show Package Contents"
3. Open Wide.js or Tall.js file in some editor (Wide is for horizontal view, Tall for vertical)
@sinegar
sinegar / arte.sh
Created December 11, 2012 06:10
Get arte rtmp url
#!/bin/sh
# Get the RTMP url of an arte video url
# based on http://blog.wirhabenstil.de/2012/01/25/downloading-arte-7-is-just-a-one-liner-in-linux/
curl "$1" | grep CasPlayerXml.xml | sed "s/%2F/\//g" | cut -d"=" -f11 | grep videos | sed -e "s/\"//g" -e "s/%7B/:/g" -e "s/%3A/:/g" | xargs curl | grep \"fr\" | cut -d" " -f3 | cut -d"\"" -f2 | xargs curl | grep \"sd\" | cut -d">" -f2 | cut -d"<" -f1
@sinegar
sinegar / p2.js
Created October 11, 2012 03:53
return the nearest power of two
function(i) {
var v=i-1;
return (v|v>>1|v>>2|v>>3|v>>4|v>>5|v>>6|v>>7|v>>8)+1;
}
@sinegar
sinegar / requestor.awk
Created October 8, 2012 11:53
Combine tcpdump packets into requests and response times.
#!/usr/bin/awk -f
# #
#
# Inspired by http://www.percona.com/doc/percona-toolkit/2.1/pt-tcp-model.html
#
# Example usage:
# $ tcpdump -i any -s 0 -nnq -tt 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
# 1349692787.492311 IP X.X.X.X.XXXX > X.X.X.X.XXXX: tcp 1448
# $ ./requestor.awk dump.file
@sinegar
sinegar / generate.sh
Created October 8, 2012 06:06
Generate HTML index for images in directories. Expects images to be called [id]-[name/reference]-[title_underscore_instead_space].jpg
#!/bin/bash
default=`find img/* | grep -v "\."`
dirs=${1:-$default}
for d in $dirs
do
name=`basename $d`
filename=$name.html
echo "processing $filename..."