Skip to content

Instantly share code, notes, and snippets.

View obihann's full-sized avatar

Jeffrey Hann obihann

View GitHub Profile
@obihann
obihann / sticky-panes.md
Last active March 1, 2018 12:45
tmux `sticky` panes

TMUX sticky panes

Step 1

Create the session that will manage the nested/sticky panes

  • create new session named shared

      $ tmux new -s shared
    
  • rename current window

@obihann
obihann / default-readme.md
Last active August 29, 2015 14:24
Default readme

GitHub tag GitHub issues GoDoc API Docs Coverage Status Build Status Dependency Status GitHub license

#Default Readme

@obihann
obihann / conflicts.md
Last active August 29, 2015 14:22
look for merge conflicts

Search for merge conflicts by using grep and the pattern '>>>>' which is common to VCS systems such as Git, SVN, and Perforce.

Default use recursively searches based on your current folder:

$ ./conflicts.sh
Checking for conflicts in *
I've got 99 problems but merge conflicts ain't 1  :)

Alternatively you can specify a specific folder

@obihann
obihann / main,go
Created February 19, 2015 18:04
Go Composition
package main
import (
"encoding/json"
"fmt"
"log"
)
type (
AStruct struct {
@obihann
obihann / generate.php
Last active August 29, 2015 14:15
Creating a secure session token
<?php
header('Content-Type: application/json');
session_start();
define("SESSION_SALT", "lowsaltdiet");
$sessionKey = hash("sha512", SESSION_SALT . session_id());
$post_data = array(
'session' => session_id(),
@obihann
obihann / check-zeb.sh
Created August 25, 2014 18:31
TT++ MUD Log Check
#!/bin/sh
COUNT=$(cat /home/jeff/Shared/zeb.html | grep "#SESSION 'zeb' DIED." -c)
NOW=$(date +%s)
L_ERROR=$(cat /var/log/check-zeb-down)+3600
if (( $COUNT >= 1 && $L_ERROR <= $NOW )); then
date
curl --request POST https://api.pushover.net/1/messages.json --data "token=SECRET_TOKEN&user=SECRET_USER&message=Zeb is linkdead!&priority=1"
echo -e $NOW > /var/log/check-zeb-down
@obihann
obihann / organize.sh
Created August 18, 2014 13:49
Organize Images by Size
#!/bin/sh
for f in *.jpeg
do
BASE=$(basename "$f" .jpg)
mv "$f" "$BASE.jpg"
done
for f in *.jpg
do
@obihann
obihann / clean-mongo.md
Last active August 29, 2015 14:01
CleanMongo

#CleanMongo

In short I ran into a lot of trouble with MongoDB not closing cleaning in my Vagrant server, so I made this little script to stop the instance, clean it, then restart.

Built for debian based systems, or anything that uses service to handle /etc/init.d scripts.

@obihann
obihann / getURLParameter.coffee
Created May 8, 2014 14:26
CoffeeScript URL Parser
getURLParameters = (url) ->
result = {}
searchIndex = url.indexOf("?")
result if searchIndex is -1
sPageURL = url.substring(searchIndex + 1)
sURLVariables = sPageURL.split("&")
i = 0
while i < sURLVariables.length
@obihann
obihann / index.php
Created April 1, 2014 17:24
Basic PHP script to assist the start of an API. Provides session validation and error logging.
<?php
// Start a new session
session_start();
// Configure error levels
error_reporting(E_ERROR);
ini_set('display_errors', 1);
// Empty response object
$output = (object) response;