Skip to content

Instantly share code, notes, and snippets.

View gurupras's full-sized avatar

Guru Prasad gurupras

View GitHub Profile
@gurupras
gurupras / compile.sh
Last active August 29, 2015 13:56
script to build os/161 source code
#!/bin/bash
#Each statement here is a blocking call, so we don't need explicit sleeping
#Our trusty local variables
ASST=ASST0
INVOKE_PATH=
BASE_PATH=
#how2use
@gurupras
gurupras / chatter.py
Last active April 5, 2016 22:42
Chatter
import os,sys,argparse
import socket
import struct
import traceback
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
class Message(object):
TYPE_FILE = 1
@gurupras
gurupras / check_auth.py
Last active December 15, 2015 18:24
Check auth logs
import os,sys,argparse,re
import json
import gzip
import tempfile
import glob
import requests
import pycommons
from pycommons import ListAction
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
@gurupras
gurupras / youtubeID.js
Created September 13, 2016 06:12 — forked from takien/youtubeID.js
Get YouTube ID from various YouTube URL using JavaScript
/**
* Get YouTube ID from various YouTube URL
* @author: takien
* @url: http://takien.com
* For PHP YouTube parser, go here http://takien.com/864
*/
function YouTubeGetID(url){
var ID = '';
url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
@gurupras
gurupras / docker.sh
Created August 1, 2017 16:30
Docker CE
sudo apt-get remove -y docker docker-engine
sudo apt-get update
sudo apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
@gurupras
gurupras / easing-functions.js
Created June 14, 2019 00:28
Easing functions
// This stuff was obtained from somewhere..the source has been lost
const EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t * t },
// decelerating to zero velocity
easeOutQuad: function (t) { return t * (2 - t) },
// acceleration until halfway, then deceleration
easeInOutQuad: function (t) { return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t },
@gurupras
gurupras / .tmux.conf
Last active October 24, 2020 03:59
tmux conf
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
@gurupras
gurupras / distributed-mediasoup.js
Created May 27, 2020 13:41
mediasoup horizontal scaling
onServerStartup () {
const { serverId, ip } = getServerInfo() // serverId does not change across restarts
this.serverId = serverId
// We don't have any routers or producers (yet). Clear any value that exists in the DB related to our serverId
clearSharedDB(serverId, 'routers')
clearSharedDB(serverId, 'producers')
// Update the DB with our serverId and ip so that others will know how to reach us
registerServerInDB(serverId, ip)
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac