Skip to content

Instantly share code, notes, and snippets.

View sameersbn's full-sized avatar

Sameer Naik sameersbn

View GitHub Profile
@joshisa
joshisa / URL Parsing
Created February 3, 2017 02:27
Parsing of URLs using bash sh scripting
#!/bin/bash
# Referenced and tweaked from http://stackoverflow.com/questions/6174220/parse-url-in-shell-script#6174447
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')"
# remove the protocol
url="$(echo ${1/$proto/})"
# extract the user (if any)
userpass="$(echo $url | grep @ | cut -d@ -f1)"
pass="$(echo $userpass | grep : | cut -d: -f2)"
if [ -n "$pass" ]; then
@ankurk91
ankurk91 / github_gpg_key.md
Last active April 9, 2024 16:34
Signing git commits using GPG (Ubuntu/Mac)

Github : Signing commits using GPG (Ubuntu/Mac) 🔐

  • Do you have an Github account ? If not create one.
  • Install required tools
  • Latest Git Client
  • gpg tools
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/
@chris-jamieson
chris-jamieson / setup.md
Created April 19, 2016 15:43
Set up Franz for Ubuntu
  • Download Franz for your distribution from MeetFranz.com
  • change into the same directory as the downloaded file, then sudo tar -xf Franz-linux-x64-0.9.10.tgz -C /opt/franz
  • (optional) wget "https://cdn-images-1.medium.com/max/360/1*v86tTomtFZIdqzMNpvwIZw.png" -O franz-icon.png then sudo cp franz-icon.png /opt/franz
  • (optional) sudo touch /usr/share/applications/franz.desktop then sudo vim /usr/share/applications/franz.desktop

paste the following lines into the file, then save the file:

[Desktop Entry]
Name=Franz
Comment=
@cyrusboadway
cyrusboadway / google-domains-dynamic-dns-update.sh
Created February 20, 2016 17:21
Script to update a Google Domains DNS record
#!/bin/bash
### Google Domains provides an API to update a DNS "Syntheitc record". This script
### updates a record with the script-runner's public IP, as resolved using a DNS
### lookup.
###
### Google Dynamic DNS: https://support.google.com/domains/answer/6147083
### Synthetic Records: https://support.google.com/domains/answer/6069273
USERNAME=""
@leesei
leesei / colors.source
Created November 28, 2014 09:05
#bash #color-source Color macro for BASH
# prompt color and format variables
# A color init string consists of one or more of the following numeric codes:
# * Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# * Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# * Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
# * Extended color codes for terminals that support more than 16 colors:
@tott
tott / ip_in_range.php
Created November 27, 2013 22:46
php check if IP is in given network range
/**
* Check if a given ip is in a network
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
* @return boolean true if the ip is in this range / false if not.
*/
function ip_in_range( $ip, $range ) {
if ( strpos( $range, '/' ) == false ) {
$range .= '/32';
}
@dysinger
dysinger / ubuntu-13.10-docker-0.6.5.sh
Created October 31, 2013 22:40
ok the steps for ubuntu 13.10 w/ docker are a tiny bit debian-tricky but easy enough. You have to add saucy-proposed to your repos & pin * at 400 from that repo. then you install lxc from that repo. So the install goes like this:
cat >/etc/apt/preferences.d/saucy-proposed <\EOF
Package: *
Pin: release a=saucy-proposed
Pin-Priority: 400
EOF
cat >/etc/apt/sources.d/saucy-proposed.list <\EOF
deb http://us.archive.ubuntu.com/ubuntu/ saucy-proposed main restricted universe
deb-src http://us.archive.ubuntu.com/ubuntu/ saucy-proposed main restricted universe
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 8, 2024 07:49
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname