Skip to content

Instantly share code, notes, and snippets.

@uraimo
uraimo / digitalocean_swiftbuild.sh
Created June 30, 2016 12:54
digitalocean_swiftbuild.sh
#!/bin/sh
YOU="%%%%%YOUR GIT USERNAME HERE%%%%%"
## Use with a droplet and Ubuntu 15+
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git vim cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev
sudo apt-get clean; sudo apt-get autoremove; sudo apt-get purge
import Glibc
var sz = winsize()
let res = ioctl(0, UInt(TIOCGWINSZ),&sz)
print("Screen width: ", sz.ws_col, "Screen height: " ,sz.ws_row)
pi@raspberrypi:~ $ apt list --installed
Listing... Done
acl/stable,now 2.2.52-2 armhf [installed]
adduser/stable,now 3.113+nmu3 all [installed]
alsa-utils/stable,now 1.0.28-1 armhf [installed,automatic]
apt/stable,now 1.0.9.8.4 armhf [installed]
apt-listchanges/stable,now 2.85.13+nmu1 all [installed]
apt-utils/stable,now 1.0.9.8.4 armhf [installed]
aptitude/stable,now 0.6.11-1 armhf [installed]
aptitude-common/stable,now 0.6.11-1 all [installed]
@uraimo
uraimo / swift3_raspbian_may2016
Last active March 22, 2017 13:08
How to use new joe's builds of Swift3 on a Raspberry with raspbian may 2016
sudo vim /etc/apt/sources.list
# replace every occurence of jessie with stretch (it's the upcoming Debian 9)
sudo apt-get update (don't upgrade!)
sudo apt-get install libicu-dev
#undo the changes to sources.list, update again
  1. Use a cp2102 usb-to-uart adapter or something similar

  2. Cross-connect to the first three pins of the first column of the right header: GND,TX,RX.

  3. Connect with minicom to the usb device, 115200,no parity,8 bits, 2 stop bits

Keybase proof

I hereby claim:

  • I am uraimo on github.
  • I am uraimo (https://keybase.io/uraimo) on keybase.
  • I have a public key ASB3_Fgns26IOoIg0jNmT2xC0bb1qeHwyAmDRXAX8OInpAo

To claim this, I am signing this object:

If you need to clone a big repository on a slow and unreliable connection, you can do a minimal shallow clone:

  git clone --depth=1 <git url>

Then deepen this clone from inside the repo with:

 git fetch --depth=N

Or just:

@uraimo
uraimo / keybase_local_pgp.md
Created May 10, 2017 17:15
Exporting LOCAL Keybase PGP keys

If you stored locally your pgp private key and didn't upload it on keybase.io (well done), you can get your private key, for example to register it in the local gpg, this way:

keybase pgp export -secret

Reported successes using my binaries on different linuxes:

Ubuntu Core 16 on a Raspi3: Used the mate version and installed clang libpython3.5-dev libcurl3 (or likely libcurl4-nss-dev)

Debian Pi64 on a Raspi3: Used the mate version, installed clang-3.8 libicu-dev libcurl4-nss-dev and copied over libicu.so.55 from an Ubuntu Mate 16.04 system

Armbian(a modified xenial) on an Asus Tinkerboard

Tail recursive version of fibonacci:

func fibTail(_ n: Int, _ a: Int = 0,_ b: Int = 1) -> Int{
    if n == 0 { return a }
    if n == 1 { return b }
    return fibTail(n-1,b,a+b)
}