Skip to content

Instantly share code, notes, and snippets.

Chetan Kunte ckunte

Block or report user

Report or block ckunte

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ckunte
ckunte / hstp.py
Last active Oct 7, 2019
Obtaining Hs and Tp values for a 5-year return period from an array of return period parameters furnished
View hstp.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Obtaining Hs and Tp values for a 5-year return period from an
array of available return period parameters.
2019 ckunte
"""
import numpy as np
import matplotlib.pyplot as plt
@ckunte
ckunte / regex.list
Last active Nov 2, 2019
Blocklist, which lives in /etc/pihole/regex.list
View regex.list
(^|\.)33across\.
(^|\.)alluremedia\.
(^|\.)aternity\.
(^|\.)coin-hive\.
(^|\.)condenastdigital\.
(^|\.)doubleclick\.
(^|\.)go-mpulse\.
(^|\.)google-analytics\.
(^|\.)googletagmanager\.
(^|\.)mediavoice\.
@ckunte
ckunte / srv.py
Last active Sep 4, 2019
SimpleHTTPServer script for clean URLs
View srv.py
#!/usr/bin/env python
# SimpleHTTPServer script for clean URLs shared by R. Scott-Adams
# Source: https://stackoverflow.com/a/28467686
import os
import SimpleHTTPServer
class SuffixHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
"""
Overrides the default request handler to assume a suffixless resource is
actually an html page of the same name. Thus, http://localhost:8000/foo
@ckunte
ckunte / tp.sh
Last active Aug 3, 2019
Transperth bus timings
View tp.sh
#!/usr/bin/env bash
# tp.sh -- Transperth bus timings from/to near my stop
# 2019 ckunte
if [ -z "$*" ]; then
echo 'Include start hour or min. Examples:'
echo 'sh tp.sh 16'
echo 'sh tp.sh :2'
exit 0
fi
echo 'Transperth bus(es) starting at' $1':'
@ckunte
ckunte / prompt.sh
Created Jul 26, 2019
Simple colorful bash prompt with git status
View prompt.sh
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1='\e[36m\u\e[39m at \e[35m\h\e[39m \e[93m\w\e[39m \e[32m$(git_branch)\e[39m\n$ '
@ckunte
ckunte / tmux-copy-paste.md
Last active Aug 3, 2019
Copy and paste in tmux
View tmux-copy-paste.md

In Windows (Cygwin, via)

Using mouse (ensure the following is in your .tmux.conf file: set -g mouse on)

  1. Copy text: Hold shift + select text with left-button
  2. Paste text: Hold shift + middle-button

In macOS (Terminal, via)

  1. Copy text: Hold fn + cmd + c
@ckunte
ckunte / nd.sh
Created Jul 14, 2019
Count days from start to end dates
View nd.sh
#!/usr/bin/env bash
# nd.sh -- count days from start to end dates input inline
# 2019 ckunte
if [ -z "$*" ]; then
echo 'Include "start" "end" dates inline, e.g.,'
echo '$ bash nd.sh "1 Apr 2018" "31 Dec 2018"'
exit 0
fi
start_date=$1
end_date=$2
@ckunte
ckunte / fhm.sh
Created Jul 12, 2019
Fix apt-get hash sum mismatch
View fhm.sh
sudo apt -o Acquire::https::No-Cache=True -o Acquire::http::No-Cache=True update
sudo apt -o Acquire::https::No-Cache=True -o Acquire::http::No-Cache=True upgrade
@ckunte
ckunte / w2w.csv
Created Jun 16, 2019
Walk-to-work elevation on platforms
View w2w.csv
Platform Operator Location Vessel Gangway system Elevation
Solan 205 Premier Oil West of Shetlands Siem Spearfish Ampelmann 24.500m
Corvette CV Shell SNS Kroonberg Ampelmann 21.500m
Gunflint Spar Noble Energy GOM DOF Skandi7 Ampelmann 21.500m
Cutter QC Onegas SNS Kroonberg Ampelmann 21.200m
L13-FI-1 NAM SNS Kroonberg Ampelmann 19.900m
Brigantine BG Shell SNS Kroonberg Ampelmann 19.500m
Brigantine BR Shell SNS Kroonberg Ampelmann 19.500m
Carrack QA NAM SNS Kroonberg Ampelmann 18.900m
Perla field Cardon IV Gulf of Venezuela Boa Deep C Ampelmann 18.100m
@ckunte
ckunte / ddns.sh
Created Jun 16, 2019
DDNS setup for IP refresh using DNSimple
View ddns.sh
#!/bin/bash
#
# setup in /etc/anacrontab:
# 1 5 ping.daily /home/ckunte/.ddns/ddns.sh
#
TOKEN="<add token here>" # The API v2 OAuth token
ACCOUNT_ID="<add id here>" # Replace with your account ID
ZONE_ID="<add domain name here>" # The zone ID is the name of the zone (or domain)
RECORD_ID="<add record id here>" # Replace with the DNS Record ID (corresponds to A record)
IP=`curl -s http://icanhazip.com/`
You can’t perform that action at this time.