Skip to content

Instantly share code, notes, and snippets.

View aeppert's full-sized avatar

Aaron Eppert aeppert

View GitHub Profile
#!/bin/bash
# autossh.x86_64 1.4e-1.el7 @epel
# puppetlabs-stdlib.noarch 4.5.1-2.20150121git7a91f20.el7 @epel
IFS=$'\n'
get_filename() {
local line=$1
echo $i | awk '{
#!/usr/bin/python
def chunker(seq, size):
return (seq[pos:pos + size] for pos in xrange(0, len(seq), size))
def word_to_ord(s):
ret = ''
for i in s:
ret += str(ord(i))
return ret
@aeppert
aeppert / cli_to_bin.py
Created December 19, 2016 18:20
Covert a string as a command line argument to binary
#!/usr/bin/python
import sys
def to_bin(st):
return ' '.join(format(ord(x), 'b') for x in st)
def main(argv):
for x in argv[1:]:
print to_bin(x)
package main
import (
"errors"
"fmt"
"os"
"strings"
"os/exec"
)
@aeppert
aeppert / SSHwithgit2go.go
Created September 12, 2016 04:18 — forked from zchee/SSHwithgit2go.go
Working example with SSH and libgit2/git2go
package main
import (
git "github.com/libgit2/git2go"
"log"
)
func credentialsCallback(url string, username string, allowedTypes git.CredType) (git.ErrorCode, *git.Cred) {
ret, cred := git.NewCredSshKey("git", "/home/vagrant/.ssh/id_rsa.pub", "/home/vagrant/.ssh/id_rsa", "")
return git.ErrorCode(ret), &cred
@aeppert
aeppert / bug_free_buddha_comment.py
Created June 20, 2016 19:24 — forked from rsvp/bug_free_buddha_comment.py
Special comment to minimize bugs in any Python or shell code -- Buddhist ASCII Art
# To minimize bugs, include this comment:
#
#
# _oo0oo_
# o8888888o
# 88" . "88
# (| -_- |)
# 0\ = /0
# ___/`---'\___
# .' \| |// '.
@aeppert
aeppert / replace_between_two_markers.sh
Created June 14, 2016 17:58
Replace a string between markers using a variable
TLSDATE_CONFIG=" \
\thost 127.0.0.1\n\
\tport 8443\n \
\tproxy none"
sed -i -n "/source/{p;:a;N;/end/!ba;s/.*\n/${TLSDATE_CONFIG}\n/};p" /etc/tlsdate/tlsdated.conf
let fizzbuzz i = match ((i mod 3), (i mod 5)) with
| (0,0) -> "fizzbuzz"
| (_,0) -> "buzz"
| (0,_) -> "fizz"
| (_,_) -> string_of_int i ;;
let do_fizzbuzz n = for i = 1 to n do
Printf.printf "%s\n" (fizzbuzz i)
done ;;
@aeppert
aeppert / stash_slack_integration.md
Created May 24, 2016 17:52 — forked from molaschi/stash_slack_integration.md
Integrate Stash with Slack using webhooks

This is a short article on how we integrate stash and slack in openmind

First of all i assume you have:

  • a working stash installation
  • a repository you to notify slack on pushes
  • stash user with administration priviledges
  • full access to the server (linux) where stash is installed on
  • a team configured on slack
  • slack user with administration priviledges
@aeppert
aeppert / service_decorators.py
Created April 18, 2016 17:52
Service Decorators
from functools import partial
class test:
def __init__(self):
pass
@staticmethod
def stop_service(name):
print 'stopping service - %s' % (name)
@staticmethod
def start_service(name):