Skip to content

Instantly share code, notes, and snippets.

View kun-zhou's full-sized avatar
🎯
Focusing

Kun Zhou kun-zhou

🎯
Focusing
  • Bay Area
View GitHub Profile
@kun-zhou
kun-zhou / upload-github-release-asset.sh
Created December 20, 2017 12:46 — forked from stefanbuck/upload-github-release-asset.sh
Script to upload a release asset using the GitHub API v3.
#!/usr/bin/env bash
#
# Author: Stefan Buck
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner
# * repo

Keybase proof

I hereby claim:

  • I am kun-zhou on github.
  • I am kunzhou (https://keybase.io/kunzhou) on keybase.
  • I have a public key ASBod7vihNL0FQupmS_Qs6uSjHkYSUo2V4bpZeLNQUfUZAo

To claim this, I am signing this object:

@kun-zhou
kun-zhou / calRemind.sh
Last active May 21, 2023 11:29
This script is used to fetch calendar entries from `khal` and set up reminders through `notify-send` 10 minutes ahead using `at` utility. It is supposed to be executed whenever your calendar update. If you use `vdirsyncer`, probably you would want run this script after running `vdirsyncer sync`
#!/usr/bin/bash
# The line below extracts the events in each line and add quotes to them so for loop will loop through each of them
items=`khal list today|tail -n +2 #no longer needed|awk -F"\n" '{printf("\"%s\"\n"),$1}'`
echo "$items"|while read -r rem # I pipe the list because otherwise the loop will treat blank space as delimiter
do
rm_time=$(($(date +%s --date "`echo $rem | sed -n 's/^\([0-9][0-9]:[0-9][0-9]\)-.*/\1:00/p'`") - 600)) # this command extracts the starting time of the event, and convert it to EPOCH, and subtract 10 minutes from it.
rm_time=`date +%H:%M --date @$rm_time` # This converts EPOCH back to human readble form
rem_name=`echo $rem | sed -n 's/.*:[0-9][0-9] \(.*\)/\1/p'`
echo "notify-send 'Calendar Reminder: $rem_name'" | at $rm_time today
done
@kun-zhou
kun-zhou / latex2excel
Last active October 6, 2022 11:48
This script converts latex tables to excel. It can be used with multicolumns, multirows and supports booktabs package. (in fact, I only implemented it for booktabs, but implementation for normal hline is just a matter of minutes.) It will create one worksheet for each table. Usage: python tex2excel YOUR_INPUT_LATEX_FILE OUTPUT_EXCEL_NAME WARNING…
The repo has been moved to: https://github.com/kun-zhou/latex2excel