Skip to content

Instantly share code, notes, and snippets.

View obonyojimmy's full-sized avatar
💻
probably coding

jimmycliff obonyo obonyojimmy

💻
probably coding
View GitHub Profile
@obonyojimmy
obonyojimmy / StreamToString.go
Created January 14, 2017 03:47 — forked from tejainece/StreamToString.go
Golang: io.Reader stream to string or byte slice
import "bytes"
func StreamToByte(stream io.Reader) []byte {
buf := new(bytes.Buffer)
buf.ReadFrom(stream)
return buf.Bytes()
}
func StreamToString(stream io.Reader) string {
buf := new(bytes.Buffer)
@obonyojimmy
obonyojimmy / aescmd.go
Created January 15, 2017 03:57 — forked from josephspurrier/aescmd.go
Golang - Encrypt, Decrypt, File Read, File Write, Readline
package main
import (
"bufio"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
"io/ioutil"
@obonyojimmy
obonyojimmy / pcap.go
Created February 3, 2017 00:58 — forked from landonf/pcap.go
Go C ffi example
/*
* Copyright (c) 2013 Landon Fuller <landonf@mac68k.info>
* All rights reserved.
*/
/* Interface to the native pcap(3) library */
package pcap
/*
#cgo LDFLAGS: -lpcap
package main
import (
"log"
"syscall"
)
func htonsInt16(n int) int {
return int(int16(byte(n))<<8 | int16(byte(n>>8)))
}
@obonyojimmy
obonyojimmy / fetch.go
Created February 8, 2017 01:08 — forked from jtwaleson/fetch.go
Certificate fetcher in Go
package main
import "crypto/tls"
import "crypto/sha1"
import "crypto/x509"
import "fmt"
import "encoding/pem"
import "os"
import "time"
import "bufio"
@obonyojimmy
obonyojimmy / _spacing-helpers.scss
Created June 24, 2017 02:04 — forked from jacurtis/_spacing-helpers.scss
SASS Margin and Padding Helpers Loop. Generates .m-t-10 type helper classes.
/*
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.m-r-10 which gives margin-right 10 pixels.
.m-r-15 gives MARGIN to the RIGHT 15 pixels.
.m-t-15 gives MARGIN to the TOP 15 pixels and so on.
.p-b-5 gives PADDING to the BOTTOM of 5 pixels
.p-l-40 gives PADDING to the LEFT of 40 pixels
@obonyojimmy
obonyojimmy / gist:4c1c4ac84c510d1aa2e75c9b8c529cd8
Created July 11, 2017 21:14 — forked from harrisonde/gist:90431ed357cc93e12b51
Deploy Laravel 5 applications on AWS Elastic Beanstalk
# The following script will deploy a Laravel 5 applicaion on AWS Elastic Beanstalk.
# Add to .ebextensions at the root of your application and name your commands file (e.g., commands.config)
# -------------------------------- Commands ------------------------------------
# Use "commands" key to execute commands on the EC2 instance. The commands are
# processed in alphabetical order by name, and they run before the application
# and web server are set up and the application version file is extracted.
# ------------------------------------------------------------------------------
commands:
01updateComposer:
@obonyojimmy
obonyojimmy / phpmyadmin.config
Created July 12, 2017 18:39 — forked from Azrael808/phpmyadmin.config
Install and Configure PHPMyAdmin on Elastic Beanstalk
container_commands:
01_install_pma:
test: test -n "$PMA_VER" && test ! -f /tmp/phpmyadmin.tar.gz
command: |
cd /tmp
wget https://files.phpmyadmin.net/phpMyAdmin/${PMA_VER}/phpMyAdmin-${PMA_VER}-all-languages.tar.gz
wget https://files.phpmyadmin.net/phpMyAdmin/${PMA_VER}/phpMyAdmin-${PMA_VER}-all-languages.tar.gz.sha1
cd /tmp && sha1sum --check phpMyAdmin-${PMA_VER}-all-languages.tar.gz.sha1
if [[ $? == 0 ]]
then
@obonyojimmy
obonyojimmy / gist:6917ff2d5a3728668187bf3f39083031
Created July 15, 2017 02:46 — forked from belsrc/gist:672b75d1f89a9a5c192c
Simple Vue.js filters that I usually need
/**
* Changes value to past tense.
* Simple filter does not support irregular verbs such as eat-ate, fly-flew, etc.
* http://jsfiddle.net/bryan_k/0xczme2r/
*
* @param {String} value The value string.
*/
Vue.filter('past-tense', function(value) {
// Slightly follows http://www.oxforddictionaries.com/us/words/verb-tenses-adding-ed-and-ing
var vowels = ['a', 'e', 'i', 'o', 'u'];
@obonyojimmy
obonyojimmy / .gitlab.ci.yml
Created August 1, 2017 21:42 — forked from yannhowe/.gitlab.ci.yml
.gitlab.ci.yml for SSH with private key.
# Image neeeds to have ssh-client
image: docker:git
services:
- docker:dind
stages:
- staging
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY