Skip to content

Instantly share code, notes, and snippets.

View jujhars13's full-sized avatar

Jujhar Singh jujhars13

View GitHub Profile
@jujhars13
jujhars13 / proxy.nginx.conf
Last active June 6, 2023 04:43
nginx-mysql-proxy
#sudo wget http://nginx.org/download/nginx-1.9.12.tar.gz
#sudo tar -xvzf nginx-1.9.12.tar.gz
#cd nginx-1.9.12
#sudo apt-get install -y build-essential libpcre3 libpcre3-dev zlib1g-dev
#sudo ./configure --with-stream && sudo make && sudo make install
# /usr/local/nginx/conf/nginx.conf - NGINX configuration file
worker_processes 1;
@jujhars13
jujhars13 / sftp.yaml
Last active March 7, 2024 00:16
kubernetes pod example for atmoz/sftp
apiVersion: v1
kind: Namespace
metadata:
name: sftp
---
kind: Service
apiVersion: v1
metadata:
@jujhars13
jujhars13 / ftp.py
Last active January 27, 2017 17:27
temp ftp server in python when you need to update crappy wordpress plugins, I hate wordpress
#temp ftp server
#pip install pyftpdlib
#taken pretty much verbatim from https://pypi.python.org/pypi/pyftpdlib/
# when I get I change I'll update it with docopt so that you can inject in params
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
authorizer = DummyAuthorizer()
authorizer.add_user("user", "12345", "/home/nobody", perm="elradfmw")
@jujhars13
jujhars13 / gurmukhiTransliterator.bas
Created April 13, 2016 07:20
Ancient Gurmukhi to English transliterator written in EvB
'original version by Tarsem Singh of STTM
Attribute VB_Name = "Module1"
Private Function convertedChar(AscID) As String
'Debug.Print Chr(AscID) & "=" & AscID
Select Case AscID
Case 32: convertedChar = " "
Case 48: convertedChar = "0"
Case 49: convertedChar = "1"
Case 50: convertedChar = "2"
@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
@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 / ec2-security-ingress.sh
Created May 12, 2014 13:19
opening up aws ec2 security groups
echo "Getting container/machine IP address..."
ip_address=`curl -s icanhazip.com`
if [ -z "$ip_address" ];then #if icanhasip failed
ip_address=`curl -s ifconfig.me`
if [ -z "$ip_address" ];then #if still can't get ipaddress
echo "Cannot get IP address, borked :-("
exit 1 # terminate and indicate error
fi
else
echo "Got IP address of $ip_address"
@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 / 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"
@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) {