Skip to content

Instantly share code, notes, and snippets.

View eneko's full-sized avatar
💻

Eneko Alonso eneko

💻
View GitHub Profile
@eneko
eneko / Output
Created January 2, 2018 19:59
Swift 4 Dispatch on Linux
$ swift run
Hello, world!
Bye!
$ whois google.com
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
GOOGLE.COM.ACKNOWLEDGES.NON-FREE.COM.NAMESILO.COM
GOOGLE.COM.AFRICANBATS.ORG
@eneko
eneko / instabug.md
Last active May 18, 2017 18:25
Instabug -> GitHub Integration issue
@eneko
eneko / git-purge
Last active June 28, 2023 03:48
`git purge` command to delete local branches that have been deleted on remote
#!/usr/bin/env sh
set -e
echo "Pulling latest code..."
git pull
echo "Deleting local branches that were removed in remote..."
git fetch -p
git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
echo "Remaining local branches:"
git branch -vv
@eneko
eneko / ergast-indices.sql
Last active November 30, 2016 06:17
Ergast MySQL indices
-- Constructor Standings
alter table constructorstandings add index (constructorid);
alter table constructorstandings add index (raceid);
alter table constructorstandings add unique index constructorrace (constructorid, raceid);
-- Drivers
alter table drivers add unique index driverref (driverref);
-- Driver Standings
alter table driverstandings add index (driverid);
@eneko
eneko / cache.swift
Created October 25, 2016 03:13
Basic cache, failing on Ubuntu 14.04 with Swift 3.0
import Foundation
fileprivate class CachedItem<T> {
let value: T
fileprivate init(value: T) {
self.value = value
}
}
@eneko
eneko / gist:77153be33607e23cc6984e8af5bb46b0
Created September 30, 2016 21:34
Final run of vapor swift install script
$ curl -sL swift.vapor.sh/ubuntu | bash
Swift 3 Quick Installer
🖥 Operating System: ubuntu1404
📦 Installing Dependencies
🔒 Sudo required
Ign http://eu-west-1.ec2.archive.ubuntu.com trusty InRelease
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty-updates InRelease
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty-backports InRelease
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty Release.gpg
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty Release
@eneko
eneko / gist:796c1fabd61eaa0ca540e76e78be5d89
Last active September 30, 2016 21:31
First run of vapor swift install on Ubuntu
$ curl -sL swift.vapor.sh/ubuntu | bash
Swift 3 Quick Installer
🖥 Operating System: ubuntu1404
📦 Installing Dependencies
🔒 Sudo required
Ign http://eu-west-1.ec2.archive.ubuntu.com trusty InRelease
Get:1 http://eu-west-1.ec2.archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Get:2 http://eu-west-1.ec2.archive.ubuntu.com trusty-backports InRelease [65.9 kB]
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty Release.gpg
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty Release
@eneko
eneko / Array.swift
Created July 19, 2016 15:50
Array.getAt(index:) - Retrieve an item from an array by index with optional result
public extension Array {
/// Retrieve an item from an array by index with optional result
/// - parameter index: Index of the item to be retrieved
/// - returns: an item by index
public func getAt(index index: Int) -> Element? {
if count > index {
return self[index]
}
return nil
@eneko
eneko / xcodeclean.sh
Created July 19, 2016 00:04
xcodeclean
alias xcodeclean='rm -frd ~/Library/Developer/Xcode/DerivedData/* && rm -frd ~/Library/Caches/com.apple.dt.Xcode/*'