Skip to content

Instantly share code, notes, and snippets.

View npcardoso's full-sized avatar

Nuno Cardoso npcardoso

  • Porto, Portugal
View GitHub Profile

Timelapse

Rename files

To rename the images so the name corresponds to its capture date, invoke the following command. This step is useful for both guaranteeing that the final movie is in the correct order and that duplicate images are removed.

exiftool '-filename<CreateDate' -d "%Y:%m:%d %H:%M:%S.%%le" -r .
@npcardoso
npcardoso / pixelserv.sh
Last active October 24, 2015 12:12
A chroot wrapper for pixelserv (https://github.com/HunterZ/pixelserv)
#!/bin/sh
set -e
P=`readlink -m $0`
P="$P.bin"
HOME='/tmp/pixelserv/chroot'
if [[ ! -d $HOME ]]; then
echo "Creating '$HOME'"
@npcardoso
npcardoso / discover-projectile.el
Created August 26, 2014 14:44
discover.el + projectile integration
(defun projectile-get-binding (function)
(let (bindings)
(setq bindings (make-hash-table :test 'equal))
(puthash 'projectile-switch-to-buffer-other-window "4 b" bindings)
(puthash 'projectile-display-buffer "4 C-o" bindings)
(puthash 'projectile-find-dir-other-window "4 d" bindings)
(puthash 'projectile-find-file-other-window "4 f" bindings)
(puthash 'projectile-find-implementation-or-test-other-window "4 t" bindings)
@npcardoso
npcardoso / acpi_wakeups.sh
Created June 10, 2014 14:56
A script to enable/disable all acpi wakeup events
#!/bin/bash
if [[ $# > 1 || ($1 != "enable" && $1 != "disable") ]]; then
echo "Usage: $0 <enable|disable>"
exit 1
fi
if [[ $1 == "enable" ]]; then
TOGGLE=`grep '\*disabled' /proc/acpi/wakeup | cut -d ' ' -f1`
else
@npcardoso
npcardoso / force_resolution.sh
Last active August 30, 2018 20:59
This is a script that will change the resolution in Linux on a Macbook Pro Retina computer. Parts of this script were taken from https://gist.github.com/Garland-g/4552263
#!/bin/zsh
if [[ $# != 2 ]]; then
echo "Usage: Res.sh <device> <resolution_width>";
exit 1;
fi
DEV=$1
WIDTH=$(xrandr | grep $DEV -A1 | tail -n1 | sed 's/ *\([0-9]*\).*$/\1/')
HEIGHT=$(xrandr | grep $DEV -A1 | tail -n1 | sed 's/.*x\([0-9]*\).*$/\1/')
CURRENT_WIDTH=$(xrandr | grep $DEV | cut -d ' ' -f 3 | sed 's/ *\([0-9]*\).*$/\1/')
@npcardoso
npcardoso / gotta_catch_em_all
Last active August 29, 2015 13:58
A script for detecting in-your-face plagiarism in C source files
#!/bin/bash
FILES=($*)
NUM_FILES=${#FILES[@]}
function num_diffs() {
i=1
for f in $*; do
cat $f | uncrustify -q -c uncrustify.conf | grep -v "#" > tmp.c
@npcardoso
npcardoso / SIGARRA_refresh_pass
Created April 2, 2014 15:35
A script to refresh the password in SIGARRA when expiring.
#!/bin/bash
[[ $# != 2 ]] && echo "Usage: $0 <user> <pass>" && exit 1
USER=$1
CURRENT_PASS=$2
ORIGINAL_PASS=$2
CYCLES=5
URL="https://sigarra.up.pt/feup/pt/pass_cica.muda"