Skip to content

Instantly share code, notes, and snippets.

View obihann's full-sized avatar

Jeffrey Hann obihann

View GitHub Profile
@obihann
obihann / dynmotd
Last active August 29, 2015 13:56
Dynamic message of the day
#!/bin/bash
PROCCOUNT=`ps -l | wc -l`
PROCCOUNT=`expr $PROCCOUNT - 4`
if [[ $(groups) == *irc* ]]; then
ENDPROC=`cat /etc/security/limits.conf | grep "@irc" | grep nproc | awk {'print $4'}`
ENDSESSION=`cat /etc/security/limits.conf | grep "@irc" | grep maxlogins | awk {'print $4'}`
PRIVLAGED="IRC Account"
else
@obihann
obihann / irssi config
Created February 13, 2014 20:28
irssi config
servers = (
{
address = "irc.freenode.net";
chatnet = "freenode";
port = "6667";
use_ssl = "no";
ssl_verify = "no";
autoconnect = "yes";
},
{
@obihann
obihann / .nethackrc
Last active November 21, 2020 17:03
NetHack Config
OPTIONS=showexp,showscore,time,color,!autopickup,pickup_burden:unencumbered
OPTIONS=pickup_types:$?!/(+
OPTIONS=autodig,fruit:slime mold,boulder:0
OPTIONS=number_pad:2
OPTIONS=suppress_alert:3.4.3
MSGTYPE=hide "You displaced *." # pet displacement
OPTIONS=statuscolors
STATUSCOLOR=hp%100=green,hp%66=yellow,hp%50=orange
#ACTION {You can't go that way - the door is closed.}
{
#map undo;
open
}
{5}
#ACTION {You can't go that way.}
{
#map undo
@obihann
obihann / README.md
Last active August 13, 2023 21:55 — forked from jewel-andraia/README.md
Two Python scripts to help RES (Reddit Enhancement Suite) users manage their backups and convert between platforms.
@obihann
obihann / preload.coffee
Last active August 29, 2015 13:57
jQuery Image Preloader Function
$.fn.preload = ->
@each ->
$("<img/>")[0].src = this
@obihann
obihann / index.php
Last active August 29, 2015 13:57
Basic PHP error logging
<?php
// Configure error levels
error_reporting(E_ERROR);
ini_set('display_errors', 1);
// Path to err log
$errorLogs = "/var/www/logs/error.log";
// Obtain IP of remote client
$requestIP = $_SERVER['REMOTE_ADDR'];
@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;
@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 / 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.