Skip to content

Instantly share code, notes, and snippets.

View ckunte's full-sized avatar

Chetan Kunte ckunte

View GitHub Profile
@ckunte
ckunte / pi_sysinfo.sh
Last active September 13, 2024 11:53
Raspberry Pi sysinfo function
#!/bin/bash
# Define the function
display_system_info() {
# Set column width (adjust as needed)
local column_width=18
# Define a function to print data in a four-column format
print_table() {
local col1="$1"
local col2="$2"
@ckunte
ckunte / outlookreply.ahk
Created August 31, 2024 04:00
Scripting replies in Outlook with AutoHotkey v2
; Scripting replies in Outlook with AutoHotkey v2
;
; Hit Alt + x (or !x) to create a reply email (template) with
; salutation to sender's First Name from selected / opened
; email in Microsoft Outlook, which looks like this:
;
; Hello <FirstName>,
;
; Thank you for your email.
;
@ckunte
ckunte / preamble.typ
Last active July 16, 2024 06:02
Typst preamble -- an example
#let cknotes(doc) = {
// settings
set page(
header: align(left)[
#image("logo.png", width: 9%)
],
margin: (
top: 2cm,
y: 2cm,
),
@ckunte
ckunte / Typst-Cyg.sublime-build
Last active July 1, 2024 03:03
A build system for Typst via Cygwin
{
// Ctrl+B to build a .pdf file from .typ (in Sublime Text's current tab)
// Ref: https://forum.sublimetext.com/t/using-cygwin-for-build-system/8307/6
"shell_cmd" : "typst compile \"$file_name\"",
"selector" : "source.typ",
"path" : "C:\\Cygwin\\bin;$path",
"working_dir" : "$file_path"
}
@ckunte
ckunte / smallcaps.typ
Created April 18, 2024 03:54
Turn uppercase words into smallcaps in Typst
// Small caps ( see: https://github.com/typst/typst/discussions/3927 )
// Turn uppercase letters to small caps: use #sc([WORDINCAPS])
// for those that escape the REGEX match
#let sc(content) = text(features: ("c2sc",))[#content]
// For testing, comment the above line, and uncomment the line below
// let sc(content) = text(features: ("c2sc",))[#highlight(content)]
// Turn all uppercase words (any 2 or more grouping of A-Z
// ASCII characters) into small caps
@ckunte
ckunte / ctd.py
Last active April 4, 2024 03:06
Compile Typst document to PDF using Python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Compile Typst document
ctd.py 2024 ckunte
Usage: ctd.py (-f <file>)
ctd.py --help
ctd.py --version
@ckunte
ckunte / integrity-hash.sh
Created March 12, 2024 06:33
Generate SHA384 hash for file integrity check attribute in link and script tags
#!/usr/bin/env bash
# 2024 ckunte
cat <filename> | openssl dgst -sha384 -binary | openssl base64 -A | pbcopy
@ckunte
ckunte / books-read.csv
Created February 13, 2024 09:20
Books read to-date
Author Title Read (y) Like?
Arlene Pellicane Calm, Cool, and Connected 2024 Y
Brene Brown The Power of Vulnerability 2023 Y
Yuval Noah Harari Sapiens: A Brief History of Humankind 2023 Y
Yuval Noah Harari Homo Deus: A Brief History of Tomorrow 2023 Y
Yuval Noah Harari 21 Lessons for the 21st Century 2023 Y
Glen van Brummelen Trigonometry 2021 Y
William Zinsser On Writing Well - 30Ed 2021 Y
Mark Manson The Subtle Art of Not Giving a F*ck 2021 O
David Acheson The Calculus Story 2021 Y
@ckunte
ckunte / datestamp-in-vim.md
Created January 14, 2024 11:31
Get date stamp (in Y-m-d H:M format) in Vim from an abbreviation (ds)
abbr <expr> ds strftime('%Y-%m-%d %H:%M')
@ckunte
ckunte / datestamp-in-sublimetext.md
Last active January 14, 2024 11:30
Get date stamp (in Y-m-d H:M format) in Sublime Text from a shortcut (ctrl+shift+d)
  1. From Tools → Developer → New Plugin... within Sublime Text, replace the template with the following python script:

    import sublime
    import sublime_plugin
    from datetime import datetime
    
    class InsertFormattedDateCommand(sublime_plugin.TextCommand):
        def run(self, edit):

formatted_date = datetime.now().strftime("%Y-%m-%d %H:%M")