Skip to content

Instantly share code, notes, and snippets.

Kaushal Modi kaushalmodi

Block or report user

Report or block kaushalmodi

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
View parse_args_getopt.sh
#!/usr/bin/env bash
# Time-stamp: <2017-04-27 09:57:21 kmodi>
#
# Example of using getopt to parse command line options
# http://stackoverflow.com/a/29754866/1219634 Limitation: All the options
# starting with - have to be listed in --options/--longoptions, else getopt will
# error out. So this cannot be used in wrapper scripts for other applications
# where you plan to pass on the non-wrapper-script options to that wrapped
# application.
View hugo_mybuild.sh
#!/usr/bin/env bash
# Time-stamp: <2017-10-23 12:14:47 kmodi>
# Hugo build script.. for hugo version build after switching to Go dep.
# (v0.31-DEV+)
# Usage: ./hugo_mybuild.sh # Installs using origin/master
# ./hugo_mybuild.sh --rev v0.30.2
#${GOPATH}/src/github.com/gohugoio/hugo/README.md
@kaushalmodi
kaushalmodi / debugprint.html
Last active Aug 26, 2018
Pretty printing Hugo variables for debug
View debugprint.html
Thanks for stopping by.
This code has been moved to https://github.com/kaushalmodi/hugo-debugprint as a Hugo theme component.
View strfmt.rst

The most important functions and macros provided are:

  1. the format functions to render a single value as a string,
  2. the fmt macro to construct a string containing several formatted values
  3. the writefmt and printfmt family of macros to write a formatted string to a file and stdout, respectively
  4. the interp and $$ string interpolation macros to render expressions embedded in the string itself
@kaushalmodi
kaushalmodi / emacs_module_sample__bug.c
Created Jun 28, 2018
Regression caused by vm support for ref types commit
View emacs_module_sample__bug.c
/* Generated by Nim Compiler v0.18.1 */
/* (c) 2018 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, amd64, gcc */
/* Command for C compiler:
gcc -c -w -I/home/kmodi/usr_local/apps/6/emacs/master/bin -std=gnu99 -fPIC -I/home/kmodi/stow/pkgs/nim/bad/lib -o /home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/misc/nim-emacs-module/test/nimcache/emacs_module_sample.o /home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/misc/nim-emacs-module/test/nimcache/emacs_module_sample.c */
#define NIM_NEW_MANGLING_RULES
#define NIM_INTBITS 64
#include "nimbase.h"
View nim_mybuild.sh
#!/usr/bin/env bash
# Time-stamp: <2018-06-23 22:16:08 kmodi>
# Usage: ./mybuild.sh # Installs using upstream/devel
# ./mybuild.sh --rev v0.18.0
# ./mybuild.sh --rev upstream/master
set -euo pipefail # http://redsymbol.net/articles/unofficial-bash-strict-mode
IFS=$'\n\t'
View emacs-module.h
/* emacs-module.h - GNU Emacs module API.
Copyright (C) 2015-2018 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
View stow_it.sh
#!/usr/bin/env bash
# Time-stamp: <2018-05-11 15:59:07 kmodi>
# Script to stow packages from ${STOW_PKGS_ROOT} to ~/stowed
# Usage: stow_it.sh (That's it; from any directory)
# This script uses the unofficial strict mode as explained in
# http://redsymbol.net/articles/unofficial-bash-strict-mode
# Also checks have been done with www.shellcheck.net to have a level of
View nim_mybuild.sh
#!/usr/bin/env bash
# Time-stamp: <2017-05-18 08:18:01 kmodi>
# Usage: ./mybuild.sh # Installs using origin/devel
# ./mybuild.sh --rev v0.17.0
# ./mybuild.sh --rev origin/master
set -euo pipefail # http://redsymbol.net/articles/unofficial-bash-strict-mode
IFS=$'\n\t'
View hugo_new_post.sh
#!/usr/bin/env bash
# Time-stamp: <2017-04-21 17:44:04 kmodi>
# https://discuss.gohugo.io/t/auto-generate-file-name-based-on-title/4648/2?u=kaushalmodi
# This script uses the unofficial strict mode as explained in
# http://redsymbol.net/articles/unofficial-bash-strict-mode
#
# Also checks have been done with www.shellcheck.net to have a level of
# confidence that this script will be free of loopholes.. or is it? :)
You can’t perform that action at this time.