Skip to content

Instantly share code, notes, and snippets.

View skreutzberger's full-sized avatar

Sebastian Kreutzberger skreutzberger

View GitHub Profile
@skreutzberger
skreutzberger / gist:1132230
Created August 8, 2011 17:25
Keepalive of Nginx
#!/bin/bash
# shell script which checks if nginx is still running
# if not then it restarts the processes, including php-fpm
# this script should be called by a Cronjob every minute
# change the process name to whatever you want to keep alive:
PROCESS="nginx"
if ps ax | grep -v grep | grep $PROCESS > /dev/null
@skreutzberger
skreutzberger / ctprompt.sh
Created November 3, 2011 07:48
Custom Terminal Prompt
# add the following block to your ~/.bash_profile
# it will print more information and an extra char at the new line
# you can also use the Apple logo as character, just replace ⌘ with 
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
GREEN="\[\033[0;32m\]"
@skreutzberger
skreutzberger / spydev.md
Created January 15, 2012 06:45
Senior Python Dev

#Open Position "Senior Python Developer Berlin"

For a stealth hightech startup in Berlin, I am searching for 2 Senior Python Developers. The current dev team already exists of awesome UI, frontend, backend and sysadmin guys. The startup is in incubation stage, that’s why there is no website, yet.

Required professional experience:

  • 3yrs Python dev

  • 2yrs another web language

  • Amazon Web Services
  • Python Boto & Gevent
@skreutzberger
skreutzberger / python-dev-berlin.md
Created August 27, 2012 12:05
Senior Python Developer Berlin

#Open Position "Senior Python Developer Berlin"

For our stealth high-tech cloud startup in Berlin, I am searching for a capable member for our team of backend hackers. The main tasks would be writing tools for automation, deployment and scaling of multiple cloud providers. We are also working on Big Data, where the tasks are mostly data mining and processing (Map/Reduce).

In general, it is a technically very challenging high-tech position. That’s why we are looking for experienced backend hackers with a flexible mindset and skills in software design, coding and server administration (in the ratio of 10:70:20) and a reputation in the open source community.

Required professional experience:

  • Python and another web language
  • PostgreSQL & NoSQL databases
@skreutzberger
skreutzberger / js-dev-berlin.md
Created August 27, 2012 12:20
Senior Frontend Developer Berlin

#Open Position "Senior Frontend Developer Berlin"

For our stealth high-tech cloud startup in Berlin, I am searching for a capable member for our team of frontend hackers. The main task would be implementing our new browser-based web app on mobile and desktop devices and overcoming current limitations in the different implementations of the HTML5 standard. The web app sets new standards in user interface and what you can do in the browser and actually looks more like a computer game than a mobile web interface. That’s why knowledge in vector graphics programming, animation etc. is required.

In general, it is a technically very challenging high-tech position. That’s why we are looking for experienced frontend hackers with a flexible mindset and skills in software design and coding and a reputation in the open source community.

Required professional experience:

  • Javascript and another web language
  • Backbone.js
@skreutzberger
skreutzberger / randomText.swift
Created August 12, 2015 13:53
generate random text in Swift
// returns random text of a defined length
// optional bool parameter justLowerCase
// to just generate random lowercase text
func randomText(length: Int, justLowerCase: Bool = false) -> String {
var text = ""
for _ in 1...length {
var decValue = 0 // ascii decimal value of a character
var charType = 3 // default is lowercase
if justLowerCase == false {
// randomize the character type
@skreutzberger
skreutzberger / randomEmail.swift
Created August 12, 2015 14:17
generate random email adddress in Swift
// returns a random email as string
func randomEmail() -> String {
let nameLength = randomInt(5, to: 10)
let domainLength = randomInt(5, to: 10)
let domainSuffixes = ["com", "net", "org", "io", "co.uk"]
let name = randomText(nameLength, justLowerCase: true)
let domain = randomText(domainLength, justLowerCase: true)
let randomDomainSuffixIndex = Int(arc4random_uniform(UInt32(domainSuffixes.count)))
let domainSuffix = domainSuffixes[randomDomainSuffixIndex]
let text = name + "@" + domain + "." + domainSuffix
@skreutzberger
skreutzberger / randomColor.swift
Created August 12, 2015 14:38
generate random color in Swift
// returns a random color
func randomColor() -> UIColor{
let red = CGFloat(drand48())
let green = CGFloat(drand48())
let blue = CGFloat(drand48())
return UIColor(red: red, green: green, blue: blue, alpha: 1.0)
}
@skreutzberger
skreutzberger / randomIntInRange.swift
Last active August 29, 2015 14:27
generate random Int within range in Swift
// returns a random int within given range
func randomInt(from: Int, to: Int) -> Int {
let range = UInt32(to - from)
let rndInt = Int(arc4random_uniform(range + 1)) + from
return rndInt
}
@skreutzberger
skreutzberger / randomIntExtension.swift
Created August 12, 2015 15:16
extension to generate random Int in Swift
extension Int {
static func random(max: Int) -> Int {
let rnd = Int(arc4random_uniform(UInt32(max) + 1))
return rnd
}
}