Skip to content

Instantly share code, notes, and snippets.

View steinwaywhw's full-sized avatar

Steinway Wu steinwaywhw

View GitHub Profile
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active May 5, 2024 20:02
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \

Preface

This article walks you through an example of deploying a Python 3.6 application that uses Pandas and AWS S3 on AWS Lambda using Boto3 in Python in 2018. No shell, no bash, no web console, everything is automated in Python. The previous article of a Hello World example can be found here.

Again, the reason to use Python Boto3 to interact with AWS is that,

  1. I'm more familiar with Python than Bash, which means a Python script can be more flexible and powerful than Bash for me.
  2. I'm not a fun of the AWS web console. It might be easier to do certain things, but it is definitely not automated.

Introduction

@steinwaywhw
steinwaywhw / set.smt2
Last active October 15, 2023 00:32
Set in z3
; uninterpreted sort
(declare-sort Elt)
(define-sort Set (Elt) (Array Elt Bool))
; bijection Int <=> Elt
(declare-fun mkint (Int) Elt)
(declare-fun unmkint (Elt) Int)
(assert (forall ((x Int)) (= x (unmkint (mkint x)))))
(assert (forall ((e Elt)) (= e (mkint (unmkint e)))))
@steinwaywhw
steinwaywhw / client.js
Last active April 20, 2022 11:47
A minimal term.js server/client demo. To be used with node.js
var client = {};
client.run = function (options) {
options = options || {};
var socket = io.connect(options.remote || "http://localhost:8080");
socket.on('connect', function() {
var term = new Terminal({
@steinwaywhw
steinwaywhw / AWS Lambda: Hello World.md
Last active March 8, 2022 10:40
An extremely simple AWS Lambda example in Python 3.

Preface

In general, AWS services can be accessed using

  1. AWS web interface,
  2. API libraries in a programming language, such as boto3 for Python 3,
  3. AWS command-line interface, i.e. awscli.

I opted for the API library since it is

@steinwaywhw
steinwaywhw / reg-exp-fn.sml.md
Created September 13, 2015 23:55
A Copy of ml-ulex Source Code

I pasted it here because it is hard to find for me. It is publicly available at here. The total order and canonical form is clearly presented here over the original ml-ulex paper.

(* reg-exp-fn.sml
 *
 * COPYRIGHT (c) 2005 
 * John Reppy (http://www.cs.uchicago.edu/~jhr)
 * Aaron Turon (adrassi@gmail.com)
 * All rights reserved.
@steinwaywhw
steinwaywhw / Config.groovy
Created June 27, 2014 14:36
Sample log4j configuration for Grails application
import org.apache.log4j.*
import grails.util.Holders
myconfig {
myvariable {
workdir = 0
}
}
log4j = {
@steinwaywhw
steinwaywhw / ATS.sublime-build
Created October 7, 2016 01:53
A draft build system for ATS on SublimeText
{
"cmd": ["patscc", "$file"],
"shell": false,
"selector": "source.ats",
"env": {
"PATH": "$PATH:<YOUR ATS BIN DIR>",
"PATSHOME": "<YOUR PATSHOME>"},
"file_regex": "^(.+): \\d+\\(line=(\\d+), offs=(\\d+)\\) -- \\d+\\(line=\\d+, offs=\\d+\\): (.+)",
"variants": [
{
@steinwaywhw
steinwaywhw / texsvg.hs
Created June 2, 2016 17:31 — forked from lierdakil/texsvg.hs
Pandoc filter to convert math to inline svg using latex and dvisvgm
import Text.Pandoc.JSON
import System.Directory
import System.FilePath ((</>))
import qualified Data.Hash.MD5 as MD5
import System.IO.Temp
import System.Process
import Control.Monad (unless)
main :: IO ()
main = toJSONFilter mathToSvg
@steinwaywhw
steinwaywhw / README.md
Created September 1, 2015 16:03
Customization of SublimeText on Mac

User Key Bindings

[
	{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} },
	{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
	{ "keys": ["f3"], "command": "find_next"}
]