Skip to content

Instantly share code, notes, and snippets.

View jujhars13's full-sized avatar

Jujhar Singh jujhars13

View GitHub Profile
@jujhars13
jujhars13 / 1569.html
Created April 10, 2014 13:51
#1569 showing deltatre player interaction events
<!--
//#1569 deltatre.com demo
Jujhar@buto.tv
-->
<html>
<body>
<h1>#1569 deltatre.com player interaction demo</h1>
@jujhars13
jujhars13 / logger.sh
Created July 31, 2015 08:47
log stuff with info and error convenience methods
#!/bin/bash
#####log stuff with info and error convenience methods
readonly log='/var/log/my_log_file.log'
if [ ! -f "$log" ];then #attempt to create log file
touch $log
if [ ! -f "$log_file" ];then #log file still not there (permissions?)
echo "Could not create a log file at ${log}"
exit 1
fi
@jujhars13
jujhars13 / dynamic_motd.sh
Last active August 29, 2015 14:27
dynamic message of the day script
#!/bin/bash
PROCCOUNT=`ps -Afl | wc -l`
PROCCOUNT=`expr $PROCCOUNT - 5`
GROUPZ=`groups`
if [[ $GROUPZ == *irc* ]]; then
ENDSESSION=`cat /etc/security/limits.conf | grep "@irc" | grep maxlogins | awk {'print $4'}`
PRIVLAGED="IRC Account"
else
#!/bin/bash
# /etc/init.d/selenium-grid
# centos-compatible selenium-grid startup script.
# Eugene Zakharchenko <z.evgeniy[at]gmail.com>
### BEGIN INIT INFO
# Provides: selenium-grid
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@jujhars13
jujhars13 / git-merge-into.bat
Created October 12, 2012 08:28
Windows batch file for merging of branches INTO the specified branch.
@echo off
rem For git merging of branches into the branch you specify, for my covenience and possibly yours
rem created 2012-09-06 by jujhar@jujhar.com
rem *********
rem will get the current branch name, checkout the branch you specify and merge
rem the original branch into the specified branch, and check
rem *********
rem get the current branch name #http://stackoverflow.com/questions/6245570/get-current-branch-name
@jujhars13
jujhars13 / git-commit.bat
Created January 4, 2013 11:16
Windows command line based git commit using message given by whatthtecommit.com you'll need curl and git on your path too. to run: git-commit.bat <your optional commit message to be prepended on>
rem 2013-01-04 jujhar@jujhar.com
rem will run git commit and add yoru message and then append it with some random text from whatthecommit.bat
rem you'll need CURL in your path
for /f "tokens=* delims= " %%a in ('curl -s http://whatthecommit.com/index.txt') do (
git commit --verbose -a -m "%1 %%a"
)
# Ubuntu upstart file at /etc/init/yourservice.conf
pre-start script
mkdir -p /var/log/yourcompany/
end script
respawn
respawn limit 15 5
start on runlevel [2345]
@jujhars13
jujhars13 / acl.json
Created May 10, 2013 10:14
zend framework 1 acl using json config file
{
"resources": [
"error::error",
"auth::login",
"auth::logout",
"index::index",
"video::index"
],
"acl": {
"guest": [
@jujhars13
jujhars13 / ie9-js-embed.js
Created May 21, 2013 15:16
internet explorer 9 fix for buto javascript embed #379 use this in place of old embed code
(function(d, conf) {
var b = d.createElement('script');
b.setAttribute('async', true);
b.src = '//embed.buto.tv/js/' + conf.object_id;
if (b.addEventListener) { //for IE<9
b.addEventListener("load", function() {
if (window.buto)
buto.addPlayer(conf);
}, false);
} else if (b.readyState) {
@jujhars13
jujhars13 / nodejs-forever
Created October 15, 2013 16:25
init.d script for Nodejs foreverjs http://stackoverflow.com/posts/15615624 to keep a script running in production
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js init.d script /home/nodejs/sample/app.js
# see http://labs.telasocial.com/nodejs-forever-daemon/ and https://gist.github.com/nariyu/1211413
# jujhars13 2013-10-15
#
. /etc/rc.d/init.d/functions
USER="root"