Skip to content

Instantly share code, notes, and snippets.

#include <v8.h>
#include <node.h>
#include <node_object_wrap.h>
#include <queue>
#include <uv.h>
#ifdef _WIN32
#define __WINDOWS_MM__
#include "pthread.h"
@luxigo
luxigo / gnome-terminal
Created November 10, 2015 07:22
Give focus to new gnome-terminal window
#!/bin/bash
GNOME_TERMINAL_SERVER=/usr/lib/gnome-terminal/gnome-terminal-server
GNOME_TERMINAL=/usr/bin/gnome-terminal
# get last window in list for $GTS_PID
lastWindowId() {
wmctrl -p $GTS_PID -l | tail -n 1 | cut -f 1 -d ' '
}
@luxigo
luxigo / gmplayer.sh
Last active August 7, 2016 09:10
Play rar archives and directories with mplayer/gmplayer
#!/bin/bash
# gmplayer.sh - Builds and play a playlist based on the command line arguments
#
# * Command line arguments may include rar files or directory names.
#
# * Other mplayer options are preserved unless there is a file or directory
# matching the literal value.
#
# * To overcome this, command line parameters are not parsed anymore after "--"
# is encountered, and ignored after parameters listed in SKIP_PARAM below.
@luxigo
luxigo / index.html
Last active October 24, 2019 01:10
Publish your mp4 video in full-res via your own website and post them on social networks with a preview
<!DOCTYPE html>
<html>
<!--
To publish your mp4 video in full-res via your own website and to post them on social networks with a preview:
1. Create a folder on your website with the name of your video, using hyphens or underscore as word separator.
2. Upload an image named "preview.jpg" in the folder created at step 1, recommended width: 1200 pixels.
3. Upload a video named "video.mp4" in the folder created at step 1
4. If you named the files somehow else, replace occurences of "preview.jpg" and "video.mp4" below
5. In the "meta" tags below, replace <VIDEO_TITLE>, <VIDEO_DESCRIPTION>, <....
6. Upload the resulting file as "index.html" in the folder created at step 1
@luxigo
luxigo / ffmpeg-composite.sh
Created June 21, 2020 23:01
Blend original video with edge detection filter output using multiply operator with ffmpeg
#!/bin/bash
INPUT=$1
OUTPUT=$2
if [ -z "$OUTPUT" ] ; then
EXT=${INPUT##*.}
BASENAME=$(basename -- $INPUT .$EXT)
OUTPUT=$(dirname $INPUT)/$BASENAME-composite.$EXT
fi
@luxigo
luxigo / ffmpeg-composite-faster.sh
Created October 4, 2020 03:13
Blend original video with edge detection filter output using multiply operator with ffmpeg, and accelerate slow motion video/audio
#!/bin/bash
INPUT=$1
OUTPUT=$2
# the settings below converts from 480fps played at 30fps (1/8 speed slowmotion from Galaxy S9+)
# to 1/2 speed slow motion video at 60fps
SPEED_FACTOR=4
OUTPUT_FRAMERATE=60
FACTOR=$(printf %.3f "$((10**3 * 1/$SPEED_FACTOR))e-3")
@luxigo
luxigo / imap-copy.js
Created November 12, 2021 12:08
Copy missing mails after migration using IMAP
var imaps=require('imap-simple');
var src,dst;
imaps.connect({
imap: {
user: '***********',
password: '********',
host: '***********',
port: 993,