Skip to content

Instantly share code, notes, and snippets.

View davidandreoletti's full-sized avatar

David Andreoletti davidandreoletti

View GitHub Profile
@davidandreoletti
davidandreoletti / linux-vms-on-apple-m1-with-networking.md
Created September 16, 2023 14:30 — forked from max-i-mil/linux-vms-on-apple-m1-with-networking.md
Short summary to run Linux VMs on an Apple M1 host using QEMU, libvirt and HVF with a working network setup

Linux Virtual Machines with Private Network on an Apple M1 Device

Background

The aim was to be able to:

  1. Run multiple Linux VMs on an Apple M1/ARM device
  2. Use Apple's HVF for native performance speeds
  3. Configure VMs to allow network access to each other
  4. Configure VMs to allow access to the internet
  5. Not rely on custom modifications of software
@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

@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 / 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 / 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 / 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 / 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
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());
#!/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!