Skip to content

Instantly share code, notes, and snippets.

View alessandrostone's full-sized avatar

Alessandro Aresta alessandrostone

View GitHub Profile
@alessandrostone
alessandrostone / AudioPlayground.swift
Created November 11, 2022 11:11 — forked from standinga/AudioPlayground.swift
Swift Playground shows how to play multiple wav files on top of background audio file, using AVAudioPlayerNode, AVAudioMixerNode, AVAudioEngine
import AVFoundation
import UIKit
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
class AudioPlayer {
var backgroundAudioFile:AVAudioFile
var topAudioFiles: [AVAudioFile] = []
@alessandrostone
alessandrostone / appify.sh
Created December 31, 2020 11:50 — forked from oubiwann/appify.sh
appify — create the simplest possible Mac app from a shell script (adds an application icon)
#!/usr/bin/env bash
VERSION=4.0.1
SCRIPT=`basename "$0"`
APPNAME="My App"
APPICONS="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericApplicationIcon.icns"
OSX_VERSION=`sw_vers -productVersion`
PWD=`pwd`
function usage {
@alessandrostone
alessandrostone / make_portable.sh
Created December 18, 2020 15:40 — forked from Birch-san/make_portable.sh
Make a macOS executable binary or .dylib portable
#!/usr/bin/env bash
# Licensed by author Alex Birch under CC BY-SA 4.0
# https://creativecommons.org/licenses/by-sa/4.0/
# Example input:
# ./make_portable.sh mycoolbinary
# where mycoolbinary is a mach-o object file
# (for example an executable binary or a .dylib)
#
@alessandrostone
alessandrostone / stars.sh
Created October 9, 2020 14:32 — forked from sebble/stars.sh
List all starred repositories of a GitHub user.
#!/bin/bash
USER=${1:-sebble}
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-)
PAGES=$((658/100+1))
echo You have $STARS starred repositories.
echo
@alessandrostone
alessandrostone / figfonts.sh
Created November 13, 2019 22:55 — forked from mkottman/figfonts.sh
Show all ASCII art figlet fonts installed on your system using the font itself
#!/bin/sh
figlist | awk '/fonts/ {f=1;next} /control/ {f=0} f {print}' | while read font; do
echo "=== $font ==="
echo $font | figlet -f $font
done | less
CREATE OR REPLACE FUNCTION generate_sequential_uuid(p_interval_length int DEFAULT 60)
RETURNS uuid
LANGUAGE plpgsql
AS $$
DECLARE
v_i int;
v_time bigint;
v_bytes int[16] = '{}';
v_hex text[16] = '{}';
BEGIN
@alessandrostone
alessandrostone / countries.sql
Created June 12, 2019 14:51 — forked from ereli/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes. PostgreSQL compatible
CREATE SEQUENCE country_seq;
CREATE TABLE IF NOT EXISTS country (
id int NOT NULL DEFAULT NEXTVAL ('country_seq'),
iso char(2) NOT NULL,
name varchar(80) NOT NULL,
nicename varchar(80) NOT NULL,
iso3 char(3) DEFAULT NULL,
numcode smallint DEFAULT NULL,
phonecode int NOT NULL,

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@alessandrostone
alessandrostone / gen-flac-visuals
Created January 6, 2019 20:32 — forked from pR0Ps/gen-flac-visuals
Generates spectrogram and waveform images from flac files
#!/bin/sh
# Requires: audiowaveform (https://github.com/bbc/audiowaveform), metaflac, sox
zoom_start=60
zoom_duration=4
zoom_end=$((zoom_start + zoom_duration))
if [ $# -lt 1 ] || [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
echo "Generates spectrogram and waveform images from flac files"
@alessandrostone
alessandrostone / file_sharing.swift
Created May 2, 2018 16:12 — forked from artemnovichkov/file_sharing.swift
Explore Documents folder in Files.app. Inspired by Ole's tweet https://twitter.com/olebegemann/status/987346188591681536
#!/usr/bin/env xcrun --sdk macosx swift
import Foundation
enum Configuration: String {
case debug = "Debug"
case release = "Release"
}
// Get Info.plist path