Skip to content

Instantly share code, notes, and snippets.

View niftycode's full-sized avatar
🏠
Working from home

Bodo Schönfeld niftycode

🏠
Working from home
View GitHub Profile
@niftycode
niftycode / ChangeNavigationBarStyle
Last active August 29, 2015 14:19
HowTo change barStyle and tintColor of the NavigationBar in Swift
override func viewDidAppear(animated: Bool) {
var navBar = self.navigationController?.navigationBar
navBar?.barStyle = UIBarStyle.Black
navBar?.tintColor = UIColor.yellowColor
}
@niftycode
niftycode / MyButton.swift
Last active November 18, 2015 17:16
UIButton customization in Swift
import UIKit
class MyButton: UIButton {
override var highlighted: Bool {
didSet {
if (highlighted) {
self.backgroundColor = UIColor.redColor()
} else {
self.backgroundColor = UIColor.clearColor()
@niftycode
niftycode / Substrings.swift
Created March 19, 2016 10:49
Useful String extensions
extension String {
// string length
var len: Int {
return self.characters.count
}
// retrieve a single character
subscript(n: Int) -> Character {
if n < 0 || n > self.len {
@niftycode
niftycode / EpochConverter.cpp
Created August 24, 2016 14:41
Convert the UNIX time to a human readable string
/* EpochConverter */
#include <iostream>
#include <time.h>
using namespace std;
int main(int argc, const char * argv[]) {
int inputTime;
struct tm *timeinfo;
@niftycode
niftycode / familyStatus.py
Last active December 10, 2016 14:53
Line graph that shows the family status of the citizens of Kiel, Germany
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Line graph of the familiy status of the citizens of Kiel, Germany.
The data is provided by the City of Kiel.
http://kiel.de/rathaus/statistik/open_data/index.php
familyStatus.py
version: 1.3
@niftycode
niftycode / election_presidentielle.py
Last active April 24, 2017 16:54
Election presidentielle 2017 - a bar chart created with Python and matplotlib
import matplotlib.pyplot as plt
import numpy as np
plt.style.use('seaborn-bright')
fig, ax = plt.subplots()
candidats = ('Marine Le Pen', 'Emmanuel Macron', 'François Fillon', 'Benoît Hamon', 'Jean-Luc Mélenchon')
voter = [21.7,23.9,20,6.3,19.2]
y_pos = np.arange(len(candidats))
@niftycode
niftycode / btw_2017.py
Created September 25, 2017 09:31
German Federal Election 2017 (Bundestagswahl)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Election, German Bundestag 2017
Version: 1.0
Python 3.6
Date created: 25/09/2017
"""
@niftycode
niftycode / CALayerImageExample.swift
Last active January 27, 2018 16:19
This playground project shows how to modify an image with CALayer (Swift 4)
//: # CALayer Example 2
import UIKit
import PlaygroundSupport
// view with white background color
var backgroundView = UIView(frame: CGRect(x: 0, y: 0, width: 400, height: 400))
backgroundView.backgroundColor = UIColor.white
PlaygroundPage.current.liveView = backgroundView
@niftycode
niftycode / elections_bw_1980-2016.py
Last active June 10, 2018 08:37
line graph example using Python3 and Matplotlib
import matplotlib.pyplot as plt
import numpy as np
# results for the greens and the cdu
gruene = np.array([5.3, 8.0, 7.9, 9.5, 12.1, 7.7, 11.7, 24.2, 30.3])
cdu = np.array([53.4, 51.9, 49.0, 39.6, 41.3, 44.8, 44.2, 39.0, 27.0])
fig, ax = plt.subplots()
xlabels = [1980, 1984, 1988, 1992, 1996, 2001, 2006, 2011, 2016]

What

Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.

What are we using? What do you need?

  • An active AWS account. First time sign-ups are eligible for the free tier for a year
  • One Micro Tier EC2 Instance
  • With AWS we will use the stock Ubuntu Server AMI and customize it.
  • Anaconda for Python.
  • Coffee/Beer/Time