Skip to content

Instantly share code, notes, and snippets.

View kbingham's full-sized avatar

Kieran Bingham kbingham

View GitHub Profile
@rsvp
rsvp / noise.sh
Last active April 18, 2024 14:18
noise : relaxing ambient Brown noise generator (cf. white noise) | Linux bash script using sox | CogSci notes
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2019-01-02
#
# _______________| noise : ambient Brown noise generator (cf. white noise).
#
# Usage: noise [minutes=59] [band-pass freq center=1786] [wave]
# ^minutes can be any positive integer.
# Command "noise 1" will display peak-level meter.
#
# Dependencies: play (from sox package)
@vmg
vmg / sparc.c
Created November 15, 2011 23:03
Sparks in C
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
int main
(int argc
,char *ac []){int i, count = argc - 1;
double * dvalues=malloc(01- 01+count*
sizeof(double)+1); double mi=DBL_MAX,ran=.0,ma =DBL_MIN,mo;for(i= 00; argc>1
&&i<count;i=i+8-7) {double val = atof(ac[i+1]) ;if(23&&val<mi)mi= val;if(val
@misaelnieto
misaelnieto / live-mjpeg-stream.py
Last active June 26, 2024 10:08
Streaming MJPEG over HTTP with gstreamr and python - WSGI version
#!/usr/bin/python
#based on the ideas from http://synack.me/blog/implementing-http-live-streaming
# Updates:
# - 2024-04-24: Apply suggestions from @Pin80
# Run this script and then launch the following pipeline:
# gst-launch videotestsrc pattern=ball ! video/x-raw-rgb, framerate=15/1, width=640, height=480 ! jpegenc ! multipartmux boundary=spionisto ! tcpclientsink port=9999
#updated command line
#gst-launch-1.0 videotestsrc pattern=ball ! videoconvert ! video/x-raw, framerate=15/1, width=640, height=480 ! jpegenc ! multipartmux boundary=spionisto ! #tcpclientsink port=9999
from multiprocessing import Queue
@17twenty
17twenty / gist:4985374
Created February 19, 2013 12:20
Git diff odt files
To get Git to diff between your odt/odp/ods files you will need to do the following things:
Install a conversion tool
$ sudo yum install odt2txt
Create your git config info directory if it's not already there
$ mkdir -p ~/.config/git/info
Add in attributes (you can paste this straight in or edit the file accordingly)
$ cat > ~/.config/git/info/attributes <<DELIM
@casperbiering
casperbiering / rrsync-on-debian.txt
Created January 18, 2017 19:41
rrsync on debian
apt-get install rsync
nano /root/.ssh/authorized_keys
prefix key with
command="rrsync -ro ~/rsyncbackup/",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding
mkdir /root/rsyncbackup
cd /root/rsyncbackup
ln -s /backup
gunzip /usr/share/doc/rsync/scripts/rrsync.gz -c > /usr/local/bin/rrsync
chmod +x /usr/local/bin/rrsync
@nicowilliams
nicowilliams / issetugid-sadness.md
Last active July 2, 2021 00:46
issetugid() sadness

Warning: work in progress. Incomplete

People who have been in security a long time (or even not that long) know that some inputs should be treated as tainted. For example, environment variables from a user should not be used in a set-uid program, inputs from a different user should be validated, etc... Traditionally we say that the environment of a set-uid program is tainted and should not be used (or used with much care).

Therefore we want all set-uid/set-gid programs to treat their environment and user inputs as tainted.

@kylemanna
kylemanna / eth.network
Created May 11, 2017 00:01
How to prevent systemd-networkd from breaking nfsroots
# /etc/systemd/network/eth.network
# Pass nfsroot=... on the kernel command line as you'd expect
[Match]
Name=eth*
KernelCommandLine=!nfsroot
[Network]
DHCP=v4
[DHCPv4]
@qlyoung
qlyoung / linux-clang-format
Created July 17, 2017 18:37
Linux kernel style .clang-format
---
BasedOnStyle: LLVM
Language: Cpp
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Linux
AlwaysBreakBeforeMultilineStrings: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
@daniel-thompson
daniel-thompson / parallel.bash
Created November 13, 2017 19:50
bash job server
# `parallel <cmd...>` works similarly to `<cmd...> &` but limits the
# maximum job count to prevent over-zealous memory consumption when
# batch processing huge numbers of files.
parallel () {
while [ "$(jobs | wc -l)" -ge $((3 * $(nproc) / 2)) ]
do
wait -n
done
"$@" &
}
@justinschuldt
justinschuldt / raspberry-pi-zero_as_webcam.md
Last active July 4, 2024 09:01
Directions for setting up a RaspberryPi to act as a generic USB webcam

hardware/software

Webcam parts:

  • Raspberry Pi Zero W Rev 1.1
  • Raspberry Pi Camera v2 (8-megapixel)
  • Raspberry Pi High Quality Camera (12.3-megapixel)
  • Raspbian Buster Lite 2020-02-13

Webcam works with:

  • Windows 10
  • Windows 10 "Camera" app