Skip to content

Instantly share code, notes, and snippets.

@nafferro
nafferro / gist:440a85a74f0bb7a1360ece3e5488a2be
Last active May 1, 2020 13:23
Raspbian Diet - Free Space on Your Raspberry Pi
sudo apt-get purge -y wolfram-engine
sudo apt-get purge -y libreoffice*
sudo apt-get purge -y oracle-java*
sudo apt-get purge -y scratch2
sudo apt-get purge -y scratch
sudo apt-get purge -y minecraft-pi
sudo apt-get autoremove
sudo apt-get clean
@nafferro
nafferro / requirements.txt
Created June 2, 2019 10:12
Install InstaPy on raspberrypi
certifi>=2018.10.15
chardet>=3.0.4
clarifai>=2.4.1
configparser>=3.5.0
EasyProcess>=0.2.3
emoji>=0.5.1
future>=0.17.1
grpcio>=1.16.1
idna>=2.7
jsonschema>=2.6.0
@nafferro
nafferro / convertDegreesToSemicircle.swift
Created April 24, 2019 11:10
Convert degrees to semicircle
func convertDegreesToSemicircle (degrees: Double) -> Int32 {
return Int32(degrees * (pow(2.0, 31.0) / 180))
}
@nafferro
nafferro / UserDefaults.swift
Created February 11, 2019 14:45
For getting all keys & values from UserDefaults
for (key, value) in UserDefaults.standard.dictionaryRepresentation() {
print("\(key) = \(value) \n")
}
@nafferro
nafferro / gist
Last active April 19, 2018 22:27
Fix LC_ALL = (unset)
sudo su
echo "LC_ALL=en_US.UTF-8" >> /etc/environment
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
locale-gen en_US.UTF-8
function FindProxyForURL(url, host) {
return "SOCKS 10.42.0.1:8889";
}
@nafferro
nafferro / UIImageColor.swift
Created June 13, 2016 09:43
How to change UIImage color
let origImage = UIImage(named: "imageName");
let tintedImage = origImage?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate)
btn.setImage(tintedImage, forState: .Normal)
btn.tintColor = UIColor.redColor()