Skip to content

Instantly share code, notes, and snippets.

View JayGoldberg's full-sized avatar

Jay Goldberg JayGoldberg

View GitHub Profile
@JayGoldberg
JayGoldberg / camwatch.sh
Last active April 18, 2017 04:33
Watch an IQeye camera HTTP stream for motion events and echo to the console
#!/bin/bash
## @author Jay Goldberg
## @email jaymgoldberg@gmail.com
## @license Apache 2.0
## @description Watch an IQeye camera HTTP stream for motion events and echo to the console
## @usage camwatch.sh <list of IQeye camera URLS>
#=======================================================================
# http://stackoverflow.com/questions/10862970/inter-process-communication-without-fifos
@JayGoldberg
JayGoldberg / is_ipv4.go
Last active May 12, 2019 12:50
determines if a string is a valid IPv4 address in golang, but the correct way to do this is to use net.ParseIP() and check for err
package main
import (
"fmt"
"strconv"
)
import "strings"
func is_ipv4(host string) bool {
parts := strings.Split(host, ".")
@JayGoldberg
JayGoldberg / mgoExample.go
Created April 11, 2016 15:32 — forked from border/mgoExample.go
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@JayGoldberg
JayGoldberg / timelapse_create.sh
Last active April 21, 2016 14:47
A Bash script to create timelapse videos from JPEGs in directories
#!/bin/bash
#title :timelapse_create.bash
#description :scans a directory for JPEGs and makes a timelapse .mov
#author :"Jay Goldberg" <jaymgoldberg@gmail.com>
#url :
#license :Apache 2.0
#requirements :avconv
#usage :./timelapse_create.bash [all,hourly,daily]
#=======================================================================
#!/bin/bash
## @author Jay Goldberg
## @email jaymgoldberg@gmail.com
## @license Apache 2.0
## @description Run web browser in a cgroup
## @usage cgroup-chrome
#=======================================================================
MB=${$1:-1024}
@JayGoldberg
JayGoldberg / findXapps.sh
Last active April 11, 2017 15:11
LINUX: Find all executables in $PATH that are likely XWindows (GUI) applications
#!/bin/bash
## @author Jay Goldberg
## @email jaymgoldberg@gmail.com
## @license Apache 2.0
## @description Find all executables in $PATH that are likely XWindows (GUI) applications
## @usage findXapps.sh
#=======================================================================
# a substring of the dynamically linked library that determines if the exe is an X app
@JayGoldberg
JayGoldberg / IsLinked.sh
Last active April 17, 2017 15:23
Is the file in question a soft or hard link to this other file?
#!/bin/sh
## @author Jay Goldberg
## @email jaymgoldberg@gmail.com
## @license Apache 2.0
## @description Determine if a file is a symlink or hardlink to a particular file
## Example, "is this file a hard or softlink to Busybox?
## @usage source it, then IsLinked <possible_link> <target>
#=======================================================================
@JayGoldberg
JayGoldberg / pgrep.sh
Last active April 11, 2017 14:50
A reimplementation of `pgrep` in shell
#!/bin/sh
## @author Jay Goldberg
## @email jaymgoldberg@gmail.com
## @license Apache 2.0
## @description Implement pgrep on platforms that don't have it
## @usage source it, then pgrep <processname>
#=======================================================================
pgrep() {
@JayGoldberg
JayGoldberg / smartportscan.sh
Created March 7, 2017 15:53
Auto-discovering port scanner in bash
#!/bin/bash
## @author Jay Goldberg
## @email jaymgoldberg@gmail.com
## @license Apache 2.0
## @description scans above/below given port
## @usage smartportscan.sh <text file with "<host> <port>" lines
#=======================================================================
#TODO(JSON output mode using jq)
@JayGoldberg
JayGoldberg / heifer.sh
Created April 11, 2017 15:25
Constrain an applications resources using cgroups
#!/usr/bin/env bash
## @author Jay Goldberg
## @email jaymgoldberg@gmail.com
## @license Apache 2.0
## @description constrains an execution to memory and cpu limits using cgroups
## @usage heifer.sh <cpushares_limit> <mem_limit> <command -args>
## @require cgcreate
## @require cgexec
## @require sudo