Skip to content

Instantly share code, notes, and snippets.

ffmpeg: skip frames
-vf select="gte(n\, 5)"
@alepez
alepez / loop.js
Created February 4, 2014 10:14
requestAnimationFrame and time since last frame (seconds)
var Loop = function (step) {
var self = this;
var lastFrameTimestamp = null;
var nextStep = function (timestamp) {
if (lastFrameTimestamp === null) {
lastFrameTimestamp = timestamp;
}
var tslf = timestamp - lastFrameTimestamp;
step(tslf);
lastFrameTimestamp = timestamp;

Livereload + NodeWebkit

Aggiungere questo a myproject/index.html

  <script src="http://localhost:35729/livereload.js"></script>

Eseguire questi comandi:

sudo npm install -g livereload

cd myproject

@alepez
alepez / hide_system_bar.java
Created April 2, 2014 10:50
Android: hide system bar (kiosk mode) [ROOT]
try {
String command = "LD_LIBRARY_PATH=/vendor/lib:/system/lib service call activity 42 s16 com.android.systemui";
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", command }, null);
proc.waitFor();
} catch (java.io.IOException e) {
e.printStackTrace();
} catch (java.lang.InterruptedException e) {
e.printStackTrace();
}
@alepez
alepez / gist:9935270
Created April 2, 2014 14:27
Raspberry silent boot: console, logo.nologo, logleve
dwc_otg.lpm_enable=0 console=tty3 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait loglevel=3 logo.nologo
@alepez
alepez / raspi-sd.sh
Created June 18, 2014 11:02
backup/resume sd with three partitions (boot, system, contents). Made for Rapsberry Pi
#!/bin/bash
ACTION=$1
SRC=$2
DST=$3
function pull {
mkdir "${DST}"
cd "${DST}"
mkdir mnt mnt/1 mnt/2 mnt/3
@alepez
alepez / raspi-fakeclock-set.sh
Created July 16, 2014 13:36
set fake clock raspberry pi
date -u "+%Y-%m-%d %H:%M:%S" > /etc/fake-hwclock.data
@alepez
alepez / Format.h
Created July 25, 2014 11:03
Create a string as printf do
#ifndef FORMAT_H_
#define FORMAT_H_
#include <string>
#include <cstdarg>
#include <cstdio>
class Format: public std::string {
public:
inline Format(const char* format, ...) {
@alepez
alepez / profile_sync.sh
Last active August 29, 2015 14:04
sync browser profile (saves ssd)
#!/bin/bash
BROWSER=$2
PERMANENT_DIR=$3
function resume {
rm ${PERMANENT_DIR}
mv ${PERMANENT_DIR}.backup ${PERMANENT_DIR}
}
@alepez
alepez / push_datetime.sh
Created September 2, 2014 13:19
set remote datetime to localhost datetime
datetime=$( date +%m%d%H%M%Y ); ssh root@remote_addr "( date $datetime; /sbin/hwclock --systohc )"