Skip to content

Instantly share code, notes, and snippets.

View ckunte's full-sized avatar

Chetan Kunte ckunte

View GitHub Profile
@ckunte
ckunte / bisect.py
Last active May 4, 2023 23:49
Using bisect for linear interpolation
#!/usr/bin/env python
# encoding: utf-8
from bisect import bisect
# Roark's Table 26, Case 10, with three edges fixed
# a / b, and b1 are defined as lists below:
a_by_b = [0.25, 0.50, 0.75, 1.00, 1.50, 2.00, 3.00]
b1 = [0.020, 0.081, 0.173, 0.321, 0.727, 1.226, 2.105]
@ckunte
ckunte / mycip.py
Created February 8, 2011 17:17
Make your own cipher and use it to generate your custom password.
#!/usr/bin/env python
# encoding: utf-8
"""
Make your own cipher and use it to
generate your custom password.
1. Think of a phrase that you love.
2. Encode it with your custom cipher.
3. Use it as your password.
@ckunte
ckunte / mchklst.sh
Created September 2, 2011 09:00
Mooring analysis checklist
#!/bin/sh
# ---------------------------------------------
# Usage:
# From the results folder, run the following:
#
# $ sh ./mchklst.sh > checklist.txt
#
# (checklist.txt would be saved in the results
# folder.)
# ---------------------------------------------
@ckunte
ckunte / cposts.php
Created September 20, 2011 17:00
WordPress page template for curated posts (for making a portfolio, or a projects page)
<?php
/*
Template Name: Curated posts
*/
?>
<?php
// Begin main loop to list page's static content:
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
@ckunte
ckunte / pkg.sh
Created August 12, 2012 07:03
Automating installation of special packages I use together with xelatex (works with MacTex Basic 2012).
#!/usr/bin/env sh
echo "Updating self, then all.."
sudo /usr/texbin/tlmgr update --self
sudo /usr/texbin/tlmgr update --all
echo "Installing fontspec marginnote realscripts sectsty xltxtra ulem .."
sudo /usr/texbin/tlmgr install fontspec marginnote realscripts sectsty xltxtra ulem
echo "All done."
@ckunte
ckunte / pin.sh
Last active March 17, 2017 18:53
Stuff to do after a fresh xubuntu install.
#!/usr/bin/env sh
echo "Stuff I do after a fresh xubuntu install:"
echo ""
echo "Installing f.lux"
sudo add-apt-repository ppa:kilian/f.lux
sudo apt-get update
echo "Installing all my favorite applications"
sudo apt-get -y install fluxgui python-pip git-core gitg gedit gedit-plugins gparted bleachbit gnome-do lightread chromium-browser zsh
echo "Removing unwanted applications"
sudo apt-get -y remove firefox
@ckunte
ckunte / c2u.py
Created September 21, 2012 11:40
Cyrillic (csv or Excel) file to UTF-8 (csv) file converter
#!/usr/bin/env python
# encoding: utf-8
"""
c2u.py
Created by ckunte on 2012-09-21.
Note: Keep the following file be placed in the same folder
as this script file.
Usage (run in Mac Terminal or Gnome Terminal):
@ckunte
ckunte / autopair-underscores-backticks.json
Created February 3, 2013 08:23
Autopair underscores and backticks in Sublime Text (2) -- for Markdown editing. Save the following under Preferences → Key Bindings - User
[ // Auto-pair underscores
{ "keys": ["_"], "command": "insert_snippet", "args": {"contents": "_$0_"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true },
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "[_a-zA-Z0-9_]$", "match_all": true },
{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.underscore", "match_all": true }
]
},
@ckunte
ckunte / ffp.sh
Created April 1, 2013 08:29
Applying permissions to folders (755) and files (644) recursively.
#!/usr/bin/env sh
echo "Applying permissions to folders as 755, and to files as 644:"
find ~/Sites/ckunte.github.com -type d -exec chmod 755 {} +
find ~/Sites/ckunte.github.com -type f -exec chmod 644 {} +
@ckunte
ckunte / hosts
Last active March 17, 2021 11:02
A copy of /etc/hosts file for blocking tracking, unwanted, and offensive sites. I am grateful to Dan Pollock for this. An original copy can be found here: http://someonewhocares.org/hosts/
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
#::1 localhost
#fe80::1%lo0 localhost