Skip to content

Instantly share code, notes, and snippets.

Jeremiah Roth rothwerx

View GitHub Profile
@y0ssar1an
y0ssar1an / .travis.yml
Last active Apr 14, 2019
Example .travis.yml for Golang
View .travis.yml
# use the latest ubuntu environment (18.04) available on travis
dist: xenial
language: go
# Force-enable Go modules. Also force go to use the code in vendor/
# These will both be unnecessary when Go 1.13 lands.
env:
- GO111MODULE=on
- GOFLAGS='-mod vendor'
@marcan
marcan / linux.sh
Last active Jan 25, 2019
Linux kernel initialization, translated to bash
View linux.sh
#!/boot/bzImage
# Linux kernel userspace initialization code, translated to bash
# (Minus floppy disk handling, because seriously, it's 2017.)
# Not 100% accurate, but gives you a good idea of how kernel init works
# GPLv2, Copyright 2017 Hector Martin <marcan@marcan.st>
# Based on Linux 4.10-rc2.
# Note: pretend chroot is a builtin and affects the current process
# Note: kernel actually uses major/minor device numbers instead of device name
View mailgun-sample.php
class Mailgun {
function post($headers, $url, $data){
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
@movitto
movitto / lvm-parser.rb
Created Mar 30, 2016
LVM Parser & Block Reader
View lvm-parser.rb
# LVM Parser & Block Reader
#
# Copyright (C) 2016 Red Hat Inc
require 'optparse'
require 'ostruct'
require 'binary_struct'
### constants
@datagrok
datagrok / README.md
Last active Mar 26, 2019
What happens when you cancel a Jenkins job
View README.md

When you cancel a Jenkins job

Unfinished draft; do not use until this notice is removed.

We were seeing some unexpected behavior in the processes that Jenkins launches when the Jenkins user clicks "cancel" on their job. Unexpected behaviors like:

  • apparently stale lockfiles and pidfiles
  • overlapping processes
  • jobs apparently ending without performing cleanup tasks
  • jobs continuing to run after being reported "aborted"
@Lukasa
Lukasa / netlink_ifnew.py
Created Mar 4, 2015
Monitor for new links using Python and Netlink
View netlink_ifnew.py
@jonaslejon
jonaslejon / Mailgun PHP API with curl
Last active Mar 22, 2019
Send mail with Mailgun API version 2 and PHP. Should also work with version 3 of the Mailgun API
View Mailgun PHP API with curl
define("DOMAIN", "test.se");
define("MAILGUN_API", "XXX123"); // Mailgun Private API Key
function br2nl($string) {
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string);
}
function mg_send($to, $subject, $message) {
$ch = curl_init();
@kimus
kimus / cx_oracle.md
Last active Apr 19, 2019
Installing python cx_oracle on Ubuntu
View cx_oracle.md

First of all, it just seems like doing anything with Oracle is obnoxiously painful for no good reason. It's the nature of the beast I suppose. cx_oracle is a python module that allows you to connect to an Oracle Database and issue queries, inserts, updates..usual jazz.

Linux

Step 1:

sudo apt-get install build-essential unzip python-dev libaio-dev

Step 2. Click here to download the appropriate zip files required for this. You'll need:

View martini-mgo.go
package main
import (
"github.com/codegangsta/martini"
"github.com/codegangsta/martini-contrib/binding"
"github.com/codegangsta/martini-contrib/render"
"labix.org/v2/mgo"
)
type Wish struct {
@hangtwenty
hangtwenty / tupperware.py
Last active Jan 26, 2019
recursively convert nested dicts to nested namedtuples, giving you something like immutable object literals
View tupperware.py
from UserDict import IterableUserDict
import collections
__author__ = 'github.com/hangtwenty'
def tupperware(mapping):
""" Convert mappings to 'tupperwares' recursively.
You can’t perform that action at this time.