Skip to content

Instantly share code, notes, and snippets.

View alessandrostone's full-sized avatar

Alessandro Aresta alessandrostone

View GitHub Profile
@lattner
lattner / async_swift_proposal.md
Last active December 28, 2024 11:11 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@ereli
ereli / countries.sql
Last active February 6, 2025 07:04 — forked from adhipg/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,
@DejanEnspyra
DejanEnspyra / Obfuscator.swift
Created May 31, 2017 17:51
Obfuscation of hard-coded security-sensitive strings.
//
// Obfuscator.swift
//
// Created by Dejan Atanasov on 2017-05-31.
//
import Foundation
class Obfuscator: AnyObject {
@sebble
sebble / stars.sh
Last active April 5, 2025 09:13
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
@oubiwann
oubiwann / appify.sh
Last active April 19, 2025 14:45 — forked from advorak/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 {
@nfreear
nfreear / leaflet-js-audio-map.html
Last active January 24, 2025 23:42
Leaflet.JS audio-player map example (Mapbox)
<!doctype html> <title> *Leaflet.JS audio-player example </title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<style>
body { font: .92em sans-serif; color: #333; background: #fefefe; max-width: 80em; margin: 0 auto; }
h1, h2 { font-weight: normal; margin: 0.6em 0; }
.leaflet-popup-content { margin: 9px; }
.leaflet-popup-content-wrapper { border-radius: 6px; }
@alessandrostone
alessandrostone / python
Last active November 12, 2016 17:12
easiest server ever
┌─────────────────────────────────────────────────────────────────────────────┐
│ __ │
│.-----.---.-.-----.--.--.-----.-----| |_ .-----.-----.----.--.--.-----.----.│
│| -__| _ |__ --| | | -__|__ --| _||__ --| -__| _| | | -__| _|│
│|_____|___._|_____|___ |_____|_____|____||_____|_____|__| \___/|_____|__| │
│ |_____| │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
# python -m SimpleHTTPServer 8000 python 2.*

🌁📉🌁🌁⬜⬜⬜🌁⬜🌁📃⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜📃🏭📃🌁📃📃🌁📃📃🏂🏂🎂📃🌁🌁🏭📃🏢🏭🎂📃🏭📃🏢📃⛲⛲🕕⬜📩🔳🍧💈📤🎲📤📉🌁🌁📃🌁⬜📈⬜⬜⬜⬜🌁⬜⬜⬜⬜⬜🌁
⬜🌁🌁⬜⬜⬜🌁🌁🌁📃📃⬜⬜⬜⬜⬜⬜🌁⬜⬜⬜⬜⬜⬜⬜⬜🌁🌁🌁🌁📃📃🌁📃💬🏢💬🌁🌁🌁🌁📃🏭💬💬🏭📃🌁🏭💬🏂⛲⛲📂⬜🌄🌄⚾📱💈📱🕖🏭📈📃🌁⬜⬜📈⬜⬜⬜🌁📝📝⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜🌁🌁🌁📃🌁🌁🌁🌁⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌁📃📃🌁📃🌁📃💬📂🏢🌁📃🏢📃📃💬🏭💬🏢🏢🏢🏢🏂⛲📖⛲🔣📉💬💌🌄📤💈👟🎲🎂🌁🌁🌁⬜⬜⬜⬜⬜⬜⬜⬜⬜🌁⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜🌁🌁📃📃📃📃📃⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌁🏭📃📃🌁📃💬🎂🔳📂🏂📃📉📉🌁⬜⬜🗼🗼🗼🗼📈📃📃📃📃🌁🎂🕓⚾📱💈💈🍜📈⬜🌁📃⬜🌁⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜🌁📃📃📃📃🏭📃⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌁🌁🌁🌁🌁📃🏂🏢📃🕕🍚🌁⬜🌁⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌁🌁🎂🔳📧👀🔩🍧🐹🌁🌁🌁⬜⬜📈🌁🌁⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜🌁💬🏂📃📃🌁📃📃⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌁🌁📃🏭🏭🍚🏂🏢🏂🌁⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜📝🕕🎲🔏🔘🐚📩🌁⬜⬜🌁🌁🌁🗼🌁🌁🌁⬜⬜⬜🌁🌁🌁🌁⬜
⬜⬜⬜📜🌁📃🏂🏢📃🏢🏢🏢🏭🌁⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌁🌁🌁🌁📈📑🎡🏢🏢📃🌁⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜📃📠😰💌🎹📤⛅🎂⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜📃📃
⬜⬜⬜🌁🏭🏭📃🏢🏢🏢🏢🏢📃⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌁🌁🌁⬜⬜🌁🎡⬜🌁🏢🏢🌁🌁⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌁💬📜💑🌄📤🏦🔤🏭⬜⬜⬜⬜⬜⬜🌁🌁📈🌁🌁📃🌁🌁🌁🏭💬
⬜🏭📃📃📃📃📃📂🏂🌁💬🏢📃⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌁🌁🌁⬜⬜🌁🏭🌁🗼💬🔳📃📃📉🗼🌁🌁⬜⬜⬜⬜⬜⬜⬜⬜⬜🌁🎂📝📜🐹🔘👀🎹💬📝🌁📈🌁🌁🌁📈📃📃📈📃📈📃📃🏭🏭🏂
🌁🌁📃📃📃📃🏢🏂📃📃🌁📃📃🌁⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜📈📃🏂📈💬📃📉🏭📈📃🏭📈📈⬜⬜🌁📃⬜⬜⬜⬜⬜⬜📈🎂🏂📄🎂💌🔘🐚😱🎂📃📈📈🏭📈📈📈📃📈📈📈📈📃🏭📃📃💬

@chockenberry
chockenberry / finder_icons.sh
Last active February 10, 2024 19:05
A simple shell script to turn the Finders desktop icons on and off
#!/bin/sh
defaults read com.apple.finder CreateDesktop > /dev/null 2>&1
enabled=$?
if [ "$1" = "off" ]; then
if [ $enabled -eq 1 ]; then
defaults write com.apple.finder CreateDesktop false
osascript -e 'tell application "Finder" to quit'
open -a Finder
@aazwar
aazwar / xcode_ramdisk.sh
Last active November 26, 2020 19:45
Speed up XCode 7
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
# PREREQUISITE:
# mkdir /Users/$USERNAME/Library/Developer/Xcode/DerivedData.shadow
## Unless you clear DerivedData folder, you can't mount ramdisk on it
# rm -r /Users/$USERNAME/Library/Developer/Xcode/DerivedData/*