Skip to content

Instantly share code, notes, and snippets.

The go playground is a great place to try out go in a browser
https://play.golang.org/
Golang dot org contains documentation for the standard library
https://golang.org/
Godoc.org contains documentation for the standard library and a bunch of other packages.
https://godoc.org
@mekuls
mekuls / Notes
Created September 6, 2016 07:07
Install mod page speed from package
60 wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_amd64.deb
61 sudo dpkg -i mod-pagespeed-beta_current_amd64.deb
62 sudo apt-get -f install
@mekuls
mekuls / Vagrantfile
Created June 23, 2016 11:56
Ansible 3 machine Vagrantfile
Vagrant.configure("2") do |config|
config.vm.define "web01" do |web01|
config.vm.box = "ubuntu/trusty64"
config.vm.hostname = "web01"
config.vm.network :private_network, ip: "10.0.1.101"
config.vm.provision "ansible" do |ansible|
ansible.playbook = "web.yml"
end
end
config.vm.define "web02" do |web02|
@mekuls
mekuls / trim.py
Last active May 6, 2016 11:39
A small gist that toys with trimming a string
import re
def regexTrim(theString):
# Neat little trim function that uses expressions and replace/substring
resultString = re.sub("^\s+", "", theString) # Trim Start
resultString = re.sub("\s+$", "", resultString) # Trim End
return resultString
def trim(theString):
@mekuls
mekuls / python_tinkering.py
Last active April 29, 2016 00:39
A bit of tinkering...
# This is the Original Code.
# list(map(lambda x: chr(int(x***2)), [8.54, 10.5, 10.72, 10.6, 10.25, 10.68, 10.04, 10, 7.07, 6.93, 7, 7.35))
# Our first iteration was this:
# list(map(lambda x: chr(int(x**2)), [8.54, 10.5, 10.72, 10.6, 10.25, 10.68, 10.04, 10, 7.07, 6.93, 7, 7.35]))
# which produced -> ['H', 'n', 'r', 'p', 'i', 'r', 'd', 'd', '1', '0', '1', '6']
# It almost looks like it ends with '2016' so we try rounding before casting
# Here's the last 4 items out of the x**2 part:
@mekuls
mekuls / Instructions.md
Created April 13, 2016 22:34
Windows Vim Setup

#filler

@mekuls
mekuls / JsQuickStart.md
Last active April 5, 2016 04:04
Javascript Quick Start

##Javascript starter app

For me, this is the minimum amount of configuration required in order to write some javascript code.

  • Make the root application directory
  • Make subfolders, one for the app and one for tests.
mkdir _app
mkdir _tests
@mekuls
mekuls / Invoke-CommandIfOffline.ps1
Last active April 2, 2016 00:54
These are some snippets of code I wrote as a proof of concept that illustrates how to run some powershell only if the user name provided is not currently logged in to the machine running the code. No production code here!
<#
.SYNOPSIS
Get's a full list of users that are currently logged
into a system.
.DESCRIPTION
Leverages WMI calls to extract user and session details
.PARAMETER UserName
Import-Module AWSPowershell
$access = "AAAAAAAAABBBBBBCCCCCCCCC"
$private = "NNNNNNNNN+OOOOOOOOPPPPPPPPP"
$bucketName = "mybucket.org"
Set-AWSCredentials -AccessKey $access -SecretKey $private
# It is imperative that the path end in a backslash
@mekuls
mekuls / Dockerfile
Last active February 23, 2016 05:34
Docker - Serving a static website using apache2
FROM ubuntu:trusty
MAINTAINER Luke Muccillo version: 0.1
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
RUN DEBIAN_FRONTEND=noninteractive apt-get update