Skip to content

Instantly share code, notes, and snippets.

View theikkila's full-sized avatar

Teemu Heikkilä theikkila

View GitHub Profile
@theikkila
theikkila / addvirtnic.sh
Last active December 11, 2015 06:09
Adding virtual interface for installing Openstack Folsom for single node with only one NIC
# Create the virtual interface, it could be anything from br10 to eth1
# Don't cry nerds it's suitable to use eth1 with QuickDeploy script 'cause otherwise you have to edit those scripts. Maybe in future the author of the script will add support for otherwise named NICs
brctl addbr eth1
ifconfig eth1 10.0.0.1 netmask 255.255.255.0
#then just run the script!
@theikkila
theikkila / bracecount.py
Created January 17, 2013 22:18
Calculates braces in file If eq prints OK, else FAIL
# Calculates braces in file
# If eq prints OK, else FAIL
import sys
fname = sys.argv[1]
file = open(fname, 'r')
OKGREEN = '\033[92m'
{
"server": {
"accessLog": "/var/log/hipache_access.log",
"port": 80,
"workers": 5,
"maxSockets": 100,
"deadBackendTTL": 30,
"https": {
"port": 443,
"key": "/etc/ssl/ssl.key",
@theikkila
theikkila / agricolaze.js
Last active August 29, 2015 14:01
Agricoloi nykysuomea wanhaxi suomexi
// BROWSERLET:
// javascript:(function(){function t(t){Object.keys(e).forEach(function(n){var r=n;var i=new RegExp(r,"gi");t=t.replace(i,e[n])});return t}function n(e){if(e.nodeType==3){e.textContent=t(e.textContent)}for(var r in e.childNodes){n(e.childNodes[r])}}var e={ja:"ia",k:"c",tt:"t",uus:"ws",oi:"oy",us:"vs",uo:"oo",jo:"io",ts:"z","iä":"ija",lta:"lda",sta:"sda",lti:"ldi",nto:"ndo","ä":"e",h:"ch",v:"w",ks:"x"};e[" on "]=" ombi ";n(document)})()
agritable = {
ja:"ia",
k:"c",
tt:'t',
uus: "ws",
oi:"oy",
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
@theikkila
theikkila / haproxy_conf.sh
Last active August 29, 2015 14:07
Mesosphere custom HAProxy
#!/bin/bash
set -o errexit -o nounset -o pipefail
function -h {
cat <<USAGE
USAGE: $name <marathon host:port>+
$name install_haproxy_system <marathon host:port>+
Generates a new configuration file for HAProxy from the specified Marathon
servers, replaces the file in /etc/haproxy and restarts the service.
@theikkila
theikkila / keywords.json
Last active November 24, 2021 14:21
7000 skill keywords
[
"Automotive",
"Budgeting",
"HVAC",
"Heaters",
"Hydraulics",
"Logistics Management",
"Management",
"Negotiation",
"Project Planning",
<h1 id="protokollakuvaus">Protokollakuvaus</h1>
<script src="http://cdn.rawgit.com/knsv/mermaid/master/dist/mermaid.full.min.js"></script>
<h2 id="yleisesti">Yleisesti</h2>
<p>Kaikki Nodet pitävät listaa muista nodeista</p>
<p>esim klusteri G = {A, B, C, D}
<div class="mermaid">
graph TD;
A---B;
B---C;
C---A;
@theikkila
theikkila / cloud-config.yml
Created February 16, 2015 21:34
CloudInit on UpCloud
#cloud-config
write_files:
- path: /run/cloud-config.yml
permissions: '0644'
content: |
#cloud-config
ssh_authorized_keys:
- ssh-rsa AAAAB....
@theikkila
theikkila / vanilla-cookies.js
Last active August 29, 2015 14:18
Vanilla Cookie support for angular
var module = angular.module('CookieModule', []);
module.service('ckeystore', function(){
this.get = function (sKey, fromJson) {
if (!sKey) { return null; }
var value = decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
if (fromJson) {return JSON.parse(value); } else { return value; }
};
this.set = function (sKey, sValue, vEnd, sPath, sDomain, bSecure, toJson) {
if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; }