Skip to content

Instantly share code, notes, and snippets.

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

Boniface Kabaso boniface

🏠
Working from home
  • Hashcode (Z) Limited
  • Lusaka, Zambia
View GitHub Profile
# Tweaked from http://tomislavsantek.iz.hr/2011/03/moving-mysql-databases-to-ramdisk-in-ubuntu-linux
# Log in as root
# Mount ramdisk folder in RAM
mkdir /tmp/ramdisk
mount -t tmpfs -o size=128M tmpfs /tmp/ramdisk/
# Move MySQL data
mv /var/lib/mysql /tmp/ramdisk/mysql
ln -s /tmp/ramdisk/mysql/ /var/lib/mysql
@boniface
boniface / gist:9066037
Created February 18, 2014 07:19
super calc
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.kabaso.calculator.service.Impl;
import com.kabaso.calculator.service.CalculatorService;
package main
import (
"github.com/gocql/gocql"
"github.com/SlyMarbo/rss"
"log"
"crypto/md5"
"encoding/hex"
"time"
"fmt"
@boniface
boniface / gist:8ddfc271676bb81a184f
Created October 18, 2014 17:00
Wordpress Migration
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsite.com', 'http://www.newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldsite.com','http://www.newsite.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldsite.com', 'http://www.newsite.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.oldsite.com', 'http://www.newsite.com');
@boniface
boniface / tomcat8.sh
Created November 8, 2014 18:02
Tomcat 8 startup Scrpt for Ubuntu
#Create Group
# groupadd tomcat
# useradd -g tomcat -d /usrlocal/tomcat8 tomcat
# usermod -G www-data tomcat
# chown tomcat:tomcat /usrlocal/tomcat8 -R
# vim /etc/init.d/tomcat
#!/bin/sh
@boniface
boniface / dockerbuildbehindproxy.sh
Last active June 13, 2016 13:58
Docker Build Behind a Prroxy
docker build -t bonifacekabaso/cassandrad:2.2.6 \
--build-arg http_proxy="http://[USER]:[PASSWD]@[IP]:[PORT]" \
--build-arg https_proxy="http://[USER]:[PASSWD]@[IP]:[PORT]" \
.
@boniface
boniface / SBT Proxy
Created August 11, 2016 12:47
SBT Proxy
-XX:MaxPermSize=384M
-Dhttps.proxyHost=10.18.8.9
-Dhttps.proxyPort=3128
-Dhttps.proxyUser=user
-Dhttps.proxyPassword=pass
-Dhttp.proxyHost=10.18.8.9
-Dhttp.proxyPort=3128
-Dhttp.proxyUser=user
-Dhttp.proxyPassword=passwd

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
#!/bin/bash
docker run --name CasDC1SeedOne \
-e WEAVE_CIDR=10.10.10.5/16 \
-e CASSANDRA_CLUSTER_NAME=CPUT \
-e CASSANDRA_DC=DC1 \
-e CASSANDRA_RACK=RC1 \
-e CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch \
-v /data/cassandra/node1:/var/lib/cassandra \
-e CASSANDRA_SEEDS=10.10.10.5,10.10.10.15 \
@boniface
boniface / playdocker.sh
Created July 30, 2017 11:52
Docker Play deploy
dockerCommands := Seq(
Cmd("FROM", "anapsix/alpine-java:jdk8"),
Cmd("MAINTAINER", maintainer.value),
Cmd("WORKDIR", "/opt/docker"),
Cmd("ADD", "/opt /opt"),
ExecCmd("RUN", "chown", "-R", "daemon:daemon", "."),
Cmd("USER", "daemon"),
ExecCmd("ENTRYPOINT", "bin/hashbot"),
ExecCmd("CMD", "")
)