Skip to content

Instantly share code, notes, and snippets.

View cloudcalvin's full-sized avatar

Calvin M cloudcalvin

  • Stellenbosch South Africa
View GitHub Profile
trait elastic4s {
def get: Future[SearchResponse] = {
val client = ElasticClient.remote("127.0.0.1", 9300)
client execute { search in "ads"->"categories" }
}
}
@cloudcalvin
cloudcalvin / makeiso.sh
Last active August 29, 2015 14:09 — forked from geekle/makeiso.sh
#!/bin/bash
# Creates a bootable ISO from CoreOS' PXE images.
# Also adds a run script to the OEM partition and converts the ISO so it can boot from USB media.
# Based heavily off https://github.com/nyarla/coreos-live-iso - Thanks Naoki!
set -e
# Default configurations
SYSLINUX_VERSION="6.02"
#cloud-config
hostname: deis-server2
users:
- name: devops
passwd: $6$rounds=4096$z3E4YVD5Jq$VmaIx64Ab2pS6I0lZKMWrsvDDcQ8tv2.c1.EfDh9W2haEvzFjeKhYg2wu7ZZEttwNFBs9QUvrQxvYORLiR/qV. #devops
groups:
- sudo
- docker
coreos:
etcd:
@cloudcalvin
cloudcalvin / network-environment-setup.sh
Last active August 29, 2015 14:12
Coreos bare metal network environment setup for IPv4 variable access
#!/bin/bash
ENV="/etc/environment"
HOSTS="/etc/hosts"
# Test for RW access to $1
touch $HOSTS
touch $ENV
if [ $? -ne 0 ]; then
echo exiting, unable to modify: $ENV
@cloudcalvin
cloudcalvin / etcd.service-unit
Last active August 29, 2015 14:12
etcd2.0 setup
- name: etcd.service
command: start
content: |
[Unit]
Description=etcd
Requires=setup-network-environment.service
After=setup-network-environment.service
[Service]
EnvironmentFile=/etc/environment
User=etcd

Happy Time Go Libraries.

Another curated list like awesome-go.
Not complete. Not authoritative. Not cupcake.
Send suggestions: @squarism :)
☆ = Github stars (in September 2014)


Adapters and Drivers

@cloudcalvin
cloudcalvin / FileRecover.md
Created May 5, 2015 10:43
File Recovery Commands

#After pdfs and docs have been carved from filsystem, the folowing commands can be used to search for specific documents ##Search for PDF containing specific text: find . -name '.pdf' -exec sh -c 'pdftotext -q "{}" - | grep --with-filename --label="{}" --color "Search Query"' ; ##Search for .doc or .DOC files containing specific text: find -name '.doc' | while read -r file; do
catdoc "$file" | grep -H --label="$file" "Search Query" done

@cloudcalvin
cloudcalvin / git.sh
Created July 23, 2015 13:28
Git wrapper script to add rsa key specification capability with the -i flag.
#!/bin/bash
# The MIT License (MIT)
# Copyright (c) 2013 Alvin Abad
# https://alvinabad.wordpress.com/2013/03/23/how-to-specify-an-ssh-key-file-with-the-git-command
if [ $# -eq 0 ]; then
echo "Git wrapper script that can specify an ssh-key file
Usage:
git.sh -i ssh-key-file git-command
@cloudcalvin
cloudcalvin / rayTest.cpp
Last active August 29, 2015 14:26 — forked from sloriot/gist:5291656
Nanoflann vs CGAL KD-tree implementation of photon ray tracer for speed comparison
#include <CGAL/Timer.h>
/// Nanoflann code
#include <nanoflann.hpp>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <vector>
@cloudcalvin
cloudcalvin / CaseClassToString.scala
Created August 16, 2015 19:06
Print Scala class members fields with types
object Implicits {
implicit class CaseClassToString(c: AnyRef) {
def toStringWithFields: String = {
val fields = (Map[String, Any]() /: c.getClass.getDeclaredFields) { (a, f) =>
f.setAccessible(true)
a + (f.getName -> f.get(c))
}
s"${c.getClass.getName}(${fields.mkString(", ")})"