Skip to content

Instantly share code, notes, and snippets.

View GiriB's full-sized avatar

Giri Bhatnagar GiriB

View GitHub Profile
@GiriB
GiriB / my.bashrc
Last active May 27, 2022 20:31
Powershell shortcuts for Git
echo "wow... loading your aliases GGB"
alias gita='git add'
alias gitc='git commit -m'
alias gits='git status'
alias gitba='git branch -a'
alias gitl='git log'
alias gitd='git diff'
alias gitcm='git checkout master'
alias gitp='git pull'
alias gitpp='git push'
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@GiriB
GiriB / inside.poly.lua
Created June 25, 2016 08:01
"Ray Casting Method" to find if a point in a polygon in lua
-- Port of http://www.ariel.com.au/a/python-point-int-poly.html in lua
-- # Determine if a point is inside a given polygon or not
-- # Polygon is a list of (x,y) pairs. This function
-- # returns True or False. The algorithm is called
-- # the "Ray Casting Method".
function point_inside_poly(x,y,poly)
-- poly is like { {x1,y1},{x2,y2} .. {xn,yn}}
-- x,y is the point
local inside = false
@GiriB
GiriB / BatteryNotify.py
Created May 7, 2016 11:03
Get Battery Low Notifications in the Mac OSX Notification Center
#!/usr/local/bin/python
# author : Giri Gaurav Bhatnagar
# email : giri1gb@gmail.com
# Sends a notification in the Notification Center
# when Battery is less than THRESHOLD value
# Needs terminal-notifier : https://github.com/julienXX/terminal-notifier
import os,time
@GiriB
GiriB / OpenUrl.java
Last active April 15, 2023 05:16
Open a URL in the default browser from Java
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public static void main(String args[]){
Desktop desktop = java.awt.Desktop.getDesktop();
try {
//specify the protocol along with the URL
URI oURL = new URI(