Skip to content

Instantly share code, notes, and snippets.

View blackknight36's full-sized avatar
💭
I may be slow to respond.

Michael blackknight36

💭
I may be slow to respond.
View GitHub Profile
@blackknight36
blackknight36 / pre-commit
Created May 13, 2016 20:35 — forked from fluxrad/pre-commit
A pre-commit git hook to validate puppet syntax
#!/bin/bash
# pre-commit git hook to check the validity of a puppet manifest
#
# Prerequisites:
# gem install puppet-lint puppet
#
# Install:
# /path/to/repo/.git/hooks/pre-comit
# Source RVM if needed
#!/usr/bin/env python
import json
import requests
def main():
update_record('example.com', 'home', 'ID')
def update_record(zone, name, id):
newip = requests.get('https://icanhazip.com').text.rstrip()
#!/usr/bin/env python
import json
import requests
def main():
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'}
url = 'https://api.digitalocean.com/v2/domains/example.com/records'
r = requests.get(url, headers=headers)
@blackknight36
blackknight36 / tmux-cheatsheet.markdown
Created January 13, 2017 13:46 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
#include <parted/parted.h>
#include <parted/device.h>
#include <parted/debug.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#!/bin/bash
# pre-commit git hook to check the validity of a puppet manifest
#
# Prerequisites:
# gem install puppet-lint puppet
#
# Install:
# /path/to/repo/.git/hooks/pre-comit
# Source RVM if needed
#!/bin/sh
#
# This script will create the Iozone graphs using
# gnuplot.
#
#
#
# ------------------------------------------------
# YOU MUST PROVIDE A FILE NAME FOR IT TO PROCESS.
# This filename is the name of the file where you
#!/usr/bin/ruby
n = 5
z = 1
while n > 0
z += 4*(n-1)
n -= 1
end
#!/usr/bin/ruby
def partition(ar, start, stop)
pivot = ar[stop]
pindex = start
for i in (start..stop-1) do
if ar[i] <= pivot
ar[i], ar[pindex] = ar[pindex], ar[i]
pindex += 1
end
#!/usr/bin/ruby
def quicksort(ar)
return ar if ar.length < 2
left = []
equal = []
right = []
p = ar[0]
ar.each do |i|