Skip to content

Instantly share code, notes, and snippets.

View dnlcrl's full-sized avatar

dnlcrl

View GitHub Profile
@dnlcrl
dnlcrl / xibtonib.sh
Last active December 13, 2021 11:11 — forked from ssp/xibtonib.sh
Convert .xib files to .nib files
#! /bin/sh
find . -name "*.xib" -type f | awk '{sub(/.xib/,"");print}' | xargs -I % ibtool --compile %.nib %.xib
@dnlcrl
dnlcrl / capture.os
Last active January 3, 2016 12:42
Capture an image and send it with iMessage
#!/usr/bin/osascript
set rec to "1234567890"
set appleid to "E:XXXXXX@gmail.com"
set today to current date
set currentDayNumber to day of today as string
set currentMonthName to month of today as string
set currentYear to year of today as string
set theDate to (currentMonthName & " " & currentDayNumber & ", " & currentYear & ".")
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Code by @incorvengent (Anders Hoff - https://github.com/inconvergent/orbitals)
Inspired by http://www.complexification.net/gallery/machines/happyPlace/index.php
'''
import cairo
from PIL import Image
import numpy as np
@dnlcrl
dnlcrl / screen_timelapse.sh
Last active January 3, 2016 12:40
Take a screenshot every 2 secs
#! /bin/sh
i=1;while [ 1 ];do screencapture -t jpg -x $i.jpg; let i++;sleep 2; done
#! /bin/sh
# cf. http://pages.uoregon.edu/noeckel/MakeMovie.html
# first convert an image sequence to a movie
ffmpeg -sameq -i %03d.jpg output.mp4
# ... and then convert the movie to a GIF animation
ffmpeg -i output.mp4 -pix_fmt rgb24 -s qcif -loop_output 0 output.gif
#! /bin/sh
# rename all PNGs in . from 0001.png to 0004.png
a=1;
for i in *.png; do
new=$(printf "%03d.png" "$a");
mv -- "$i" "$new";
let a=a+1;
done
#!/bin/sh
palette="/tmp/palette.png"
filters="fps=15,scale=320:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
# ./gifenc.sh video.mkv anim.gif
n02119789 kit fox, Vulpes macrotis
n02100735 English setter
n02110185 Siberian husky
n02096294 Australian terrier
n02102040 English springer, English springer spaniel
n02066245 grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus
n02509815 lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens
n02124075 Egyptian cat
n02417914 ibex, Capra ibex
n02123394 Persian cat
@dnlcrl
dnlcrl / brew-update-w-caffe-branch-OSX.sh
Created January 21, 2016 18:27
After instaling Caffe whenever you want to update homebrew, switch back to the master branches, do the update, rebase the caffe branches onto master and fix any conflicts.
# Switch batch to homebrew master branches
cd /usr/local
git checkout master
cd /usr/local/Library/Taps/homebrew/homebrew-science
git checkout master
# Update homebrew; hopefully this works without errors!
brew update
# Switch back to the caffe branches with the formulae that you modified earlier
@dnlcrl
dnlcrl / caffe+tensorflow+el-capitan.sh
Created January 26, 2016 12:52
fix incompatibility between tensorflow and caffe on OSX 10.11 el capitan, due to the different protobuf versions, installed by brew for caffe and by pip for tf
# follow instructions on http://caffe.berkeleyvision.org/install_osx.html except for protobuf, where you should use --devel and not use --with-python because it is the default behaviour
brew install --devel protobuf #basically you are installing protobuf 3.0, the same checked by pip for tensorflow
# continue with caffe installation, after make all and before make runtest, set the right linking lib location
install_name_tool -change libcaffe.so.1.0.0-rc3 @rpath/libcaffe.so.1.0.0-rc3 .build_release/test/test_all.testbin
install_name_tool -change libcaffe.so.1.0.0-rc3 @rpath/libcaffe.so.1.0.0-rc3 .build_release/tools/caffe
install_name_tool -change libcaffe.so.1.0.0-rc3 @rpath/libcaffe.so.1.0.0-rc3 .build_release/lib/libcaffe.so
# run make runtest, if everything is ok, before running make pycaffe set the right linking location for python
install_name_tool -change libcaffe.so.1.0.0-rc3 @rpath/libcaffe.so.1.0.0-rc3 /Users/imac/caffe/python/caffe/_caffe.so
# make pycaffe; cd caffe/python; try to run python >>>impor