Skip to content

Instantly share code, notes, and snippets.

@dundee
dundee / .bashrc
Last active September 25, 2015 15:37 — forked from lexaurin/gist:943888
Shows actual git branch on command prompt
export PS1="$PS1\$(\
export GIT_BRANCH=\"\$(git branch --no-color 2>/dev/null | grep '*' | cut -d\" \" -f2-)\"; \
if [ -n \"\$GIT_BRANCH\" ] ; then \
echo -en \"\[\033[01;33m\]\"\$GIT_BRANCH \"> \[\033[00m\]\"; \
fi \
)"
@dundee
dundee / ssh_config
Created August 5, 2011 12:18
SSH config file (~/.ssh/config)
Host milde
HostName milde.cz
User dundee
Port 1080
Host nagios
HostName nagios.milde.cz
User dundee
Port 1080
IdentityFile ~/.ssh/alternative
@dundee
dundee / gist:1274919
Created October 10, 2011 09:05
Foreach vs array_reduce
<?php
$arr = array(
array('a', '1'),
array('b', '2'),
);
// klasicky
$out = array();
@dundee
dundee / gist:1275043
Created October 10, 2011 10:58
Rychlost foreach vs array_map
<?php
$x = 3;
$max = 1000000;
$arr = array(
1,
2,
3,
);
@dundee
dundee / gist:1508578
Created December 22, 2011 02:08
X-Mass Arduino sketch
/**
* X-Mas Arduino sketch
* Uses 11 LEDs (digital pin 3 to pin 13) and one switch (digital pin 0)
*/
int switchPin = 0; // Switch connected to digital pin 0
int ledPins[] = {13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3};
int ledCount = 11;
@dundee
dundee / rgb.ino
Created December 26, 2011 13:28
RGB led
// Output
int redPin = 9; // Red LED, connected to digital pin 9
int greenPin = 10; // Green LED, connected to digital pin 10
int bluePin = 11; // Blue LED, connected to digital pin 11
int r, g, b;
int rd, gd, bd;
int wait = 20; //20ms
@dundee
dundee / gist:1926179
Created February 27, 2012 18:48
AuthenticatorFactory
<?php
class AuthenticatorFactory
{
public function __construct(PdoFactory $pdoFactory)
{
// bla
}
@dundee
dundee / gist:1926257
Created February 27, 2012 18:56
PdoFactory
<?php
class PdoFactory
{
public function __construct($pdoOptions) {
// ...
}
public function create()
@dundee
dundee / gist:4532848
Created January 14, 2013 19:58
Caching reverse proxy - Nginx vs Varnish - basic benchmark
# Varnish config
backend default {
.host = "127.0.0.1";
.port = "80";
}
# Nginx config
http {
@dundee
dundee / gist:4681935
Created January 31, 2013 10:19
Varnish configuration
acl local {
"localhost";
}
backend default {
.host = "127.0.0.1";
.port = "80";
.first_byte_timeout = 3s;
}