Skip to content

Instantly share code, notes, and snippets.

View davidandreoletti's full-sized avatar

David Andreoletti davidandreoletti

View GitHub Profile
#!/bin/sh
#/ Usage: btsync-secret [option]...
#/ A Bittorrent Sync Secret Generator
set -e
h_flag=false
v_flag=false
e_flag=false
n_flag=false
c_flag=false
#!/usr/bin/perl -w
# Key generation for BTsync.
# Author : Johan Vromans
# Created On : Sun Apr 27 20:31:57 2014
# Last Modified By: Johan Vromans
# Last Modified On: Fri May 2 15:37:24 2014
# Update Count : 47
# Status : Unknown, Use with caution!
void rethrow_cpp_exception_as_java_exception()
{
try
{
throw;
}
catch (const package::Exception& e)
{
jclass jc = env->FindClass("group/package/Exception");
if(jc) env->ThrowNew (jc, e.what());
@davidandreoletti
davidandreoletti / boost.sh
Created September 25, 2015 00:24 — forked from faithfracture/boost.sh
Boost build script for iOS (armv7, armv7s, arm64), iOS Simulator (i386, x86_64), and OSX (i386, x86_64)
#===============================================================================
# Filename: boost.sh
# Author: Pete Goodliffe
# Copyright: (c) Copyright 2009 Pete Goodliffe
# Licence: Please feel free to use this, with attribution
# Modified version
#===============================================================================
#
# Builds a Boost framework for iOS, iOS Simulator, and OSX.
# Creates a set of universal libraries that can be used on an iOS and in the
@davidandreoletti
davidandreoletti / create_install_iso.sh
Created October 20, 2015 07:22
Create OS X El Capitan Installer iso image
#!/bin/sh
INSTALLERIMG="/Applications/Install OS X El Capitan.app/Contents/SharedSupport/InstallESD.dmg"
OUTDIR="/Users/$(whoami)/Desktop"
FILENAME="Install OS X El Capitan"
TMPIMG="/tmp/ElCapitan.sparseimage"
SOURCEDISK="/Volumes/InstallESD"
TARGETDISK="/Volumes/BaseSystem"
@davidandreoletti
davidandreoletti / GenericDelegate.swift
Created September 11, 2017 22:24 — forked from smokyonion/GenericDelegate.swift
Generic Delegate Pattern in Swift 3
public protocol DataSource: class {
associatedtype AbstractType
func source() -> AbstractType
}
class ViewController<T: DataSource>: UIViewController {
weak var dataSouce: T?
typealias AbstractType = T.AbstractType
@davidandreoletti
davidandreoletti / ffmpeg_opencv.py
Created November 26, 2017 06:25 — forked from eruffaldi/ffmpeg_opencv.py
Feeding Python Opencv with FFmpeg
#
# Reading video from FFMPEG using subprocess - aka when OpenCV VideoCapture fails
#
# 2017 note: I have realized that this is similar to moviepy ffmpeg reader with the difference that here we support YUV encoding
# BUT we lack: bufsize in POpen and creation flags for windows
# https://github.com/Zulko/moviepy/blob/master/moviepy/video/io/ffmpeg_reader.py
#
# Emanuele Ruffaldi 2016
import cv2
import subprocess
@davidandreoletti
davidandreoletti / kvm-qemu.sh
Created April 21, 2019 12:25 — forked from doomedraven/kvm-qemu.sh
Linux - KVM + QEMU installer from sources :)
#!/bin/bash
#
# For latest version please check https://github.com/doomedraven/Tools/blob/master/Virtualization/kvm-qemu.sh
#
# https://www.doomedraven.com/2016/05/kvm.html
# Use Ubuntu 18.04 LTS
@davidandreoletti
davidandreoletti / postgres.md
Created July 20, 2021 07:11 — forked from junqueira/postgres.md
Postgres notes

Database commands in psql

Connect to psql as a non postgres user $ psql -d testdbname - when the os user exists in the db and trusted authentication is enabled.

# create database db2; - create a database
# drop database db2; - drop a database
# \c[onnect] db2 - connect to a database
# \l[ist] - list all databases
# \l+ - list all databases with extra details, including size