Skip to content

Instantly share code, notes, and snippets.

View martynjarvis's full-sized avatar

Martyn Jarvis martynjarvis

View GitHub Profile
@martynjarvis
martynjarvis / monitor.sh
Last active August 29, 2015 14:06
Simple bash script to monitor something.
#!/bin/bash
LOGFILE=/tmp/monitor.log
CMD="cat /proc/loadavg"
DELAY=60
while true; do
echo "$(date -u): $(eval $CMD)" >> $LOGFILE 2>&1
sleep $DELAY
done
@martynjarvis
martynjarvis / run_synergy.sh
Created October 15, 2014 07:49
run_synergy.sh
# Kill previous synergy session
killall -q ssh
killall -q synergyc
# Create ssh connection to tunnel synergy over
ssh -f -N -L localhost:24800:server-hostname:24800 server-hostname
./synergyc -f localhost
@martynjarvis
martynjarvis / mouse_acceleration.md
Last active August 29, 2015 14:08
Disable Mouse Acceleration - Ubuntu

List all devices:

$ xinput list
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Macintosh mouse button emulation          id=10   [slave  pointer  (2)]
⎜   ↳ Microsoft Microsoft 3-Button Mouse with IntelliEye(TM)    id=8    [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]

↳ Power Button id=6 [slave keyboard (3)]

@martynjarvis
martynjarvis / ord.py
Created November 13, 2014 10:53
Cardinal to Ordinal Numbers
# From Sam
ord = lambda n: "%d%s" %(n ,"tsnrhtdd" [(n/10%10!=1)*(n%10<4)*n%10::4])
@martynjarvis
martynjarvis / synergy.conf
Created January 16, 2015 20:27
Synergy conf file
section: screens
172.18.35.212:
172.18.0.106:
end
section: aliases
172.18.35.212:
dhcp-212
172.18.0.106:
mac-client
@martynjarvis
martynjarvis / bug.txt
Created January 23, 2015 15:06
Decent bug report template
---Summary
---Environment Details
Environment:
Version:
Hostname:
---Reproduction steps
@martynjarvis
martynjarvis / version.py
Created January 26, 2015 14:54
Class to represent a iteration number
"""
Class to represent a iteration number as a tuple
ie, it-39.1-130956 is represented as (39,1,130956)
"""
import re
import collections
def cast_parts(parts):
for part in parts:
@martynjarvis
martynjarvis / counter.sh
Created January 26, 2015 15:05
Automatically incrementing run number in bash script
#!/bin/bash
# counter for current run number
if [ ! -e "${HOME}/.counter" ]
then
echo "creating counter file"
echo "1" > ~/.counter
fi
while read line
do
@martynjarvis
martynjarvis / Screenshots.md
Last active August 29, 2015 14:14
Create screenshots using ffmpeg/avconv

Create screenshots using ffmpeg/avconv

Create screenshots selecting only I frames that differ:

ffmpeg -i <input_filename>.ts -f image2 -vf "select='eq(pict_type,I)'" -vsync 2 out%02d.png

Create single screenshot 1 second in:

ffmpeg -ss 1 -i .ts -f image2 -vf "select='eq(pict_type,I)'" -vframes 1 -vsync 2 .png

@martynjarvis
martynjarvis / perforce.md
Last active December 4, 2019 10:55
Perforce Cheatsheet

Perforce Cheatsheet

Useful Commands:

Check I have no changes:

p4 opened

Sync to head: