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 / atom.xml
Created Mar 6, 2020
Atom feed template in Jinja
View atom.xml
{% from 'site_settings.jinja2' import site_title, site_author, site_url -%}
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ site_title }}</title>
<link rel="alternate" type="text/html" href="{{ site_url }}"/>
<link rel="self" type="application/atom+xml" href="{{ site_url }}/atom.xml"/>
{%- for entry in entries -%}
{%- if loop.index < 1 + 1 %}
<updated>{{ entry.year }}-{{ entry.month }}-{{ entry.day }}T{{ entry.hour }}:{{ entry.minute }}:{{ entry.second }}Z</updated>
@ckunte
ckunte / feed.json
Last active Mar 7, 2020
JSON feed template in Jinja
View feed.json
{% from 'site_settings.jinja2' import site_title, site_author, site_url -%}
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ site_title }}",
"description": "Description of the website",
"home_page_url": "{{ site_url }}",
"feed_url": "{{ site_url }}/feed.json",
"author": {
"name": "{{ site_author }}",
"url": "{{ site_url }}"
@ckunte
ckunte / README-smallcaps.md
Created Feb 21, 2020
Turn CAPITALISED words into SMALL CAPS on the fly on web pages
View README-smallcaps.md

Turn CAPITALISED words into SMALL CAPS on the fly

The in-line script searches contents of the body of the page for capitalised words with two or more characters, and when found, wraps them in abbr opening and closing html tags, which can then be made to look like small caps.

Javascript

This following script can be added to the head section of a page enclosed within opening and closing script tags.

  window.onload = scotf;
@ckunte
ckunte / tj_curve.py
Created Feb 19, 2020
S-N Curves for tubular joints (TJ) for both air and seawater with cathodic protection, ref: Table 16.11-1, ISO 19902:2007
View tj_curve.py
#!/usr/bin/env python
# encoding: utf-8
"""
tj_curve.py -- 2016 ckunte
May 7: Initial commit.
Feb 10, 2020: Comparing seawater and air provisions
"""
import numpy as np
import matplotlib.pyplot as plt
View git-worflow.md

git work-flow

git work-flow is first and foremost about discipline. A disorganised approach leads a repository becoming unusable over time.

For production

[Chisel] has multiple branches. Since it's forked, my master branch is always at-par with the original developer's code base. Occasionally, I branch-out of master, work-on a feature, and when it's ready, I send a pull request to the developer for merging it into the master branch — this though is exceedingly rare.

To update my site, I use the ck branch, which includes site-specific configuration, custom features, and modifications. I run Chisel as follows:

@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 Mar 22, 2020
Blocklist, which lives in /etc/pihole/regex.list
View regex.list
^(.+\.)?(facebook|fb(cdn|sbx)?|tfbnw)\.[^.]+$
(^|\.)aiv-delivery\.
(^|\.)driftt\.
(^|\.)aerserv\.
(^|\.)improvedigital\.
(^|\.)indexexchange\.
(^|\.)mobfox\.
(^|\.)openx\.
(^|\.)pubmatic\.
(^|\.)rhythmone\.
@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$ '
You can’t perform that action at this time.