Skip to content

Instantly share code, notes, and snippets.

@danchoi
danchoi / tags.hs
Last active June 27, 2019 20:02
Show all XML tags
#!/usr/bin/env stack
-- stack --resolver lts-12.21 script --package hexpat --package bytestring --package text
{-
dependency: install libexpat1-dev
sudo apt install libexpat1-dev
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/5.0.1/Rx.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs-dom/7.0.3/rx.dom.min.js"></script>
</head>
<body>
<h1>Test</h1>
@danchoi
danchoi / bash.txt
Created September 29, 2016 17:30
Common classes bootstrap.css vs custom templates
comm -1 -2 custom-classes.txt bs-classes.txt
@danchoi
danchoi / classes.txt
Last active September 29, 2016 17:25
bootstrap 2.3.2
.accordion
.accordion-group
.accordion-heading
.accordion-inner
.accordion-toggle
.active
.add-on
.affix
.alert
.alert-block
@danchoi
danchoi / vimrc
Created September 20, 2016 20:14
Comment uncomment
" Home-brewed commenter and uncommenter
" :Comment and :Uncomment will comment out a given range of lines
" or visual selection.
" Comment marks will be placed at beginning of line, and only comment
" marks at the beginning of lines will be uncommented.
" Comment mark will dynamically determined to be '#', '//' or '--' depending
" on file extension of the file in buffer, and '#' if none can be detected.
func! CommentMarker()
let ext = expand('%:e')
@danchoi
danchoi / timezones.txt
Last active June 1, 2022 03:17
timezones
# tab-separated columns are time zone, UTC offset, UTC DST offset, optional note
Africa/Abidjan +00:00 +00:00
Africa/Accra +00:00 +00:00
Africa/Addis_Ababa +03:00 +03:00
Africa/Algiers +01:00 +01:00
Africa/Asmara +03:00 +03:00
Africa/Asmera +03:00 +03:00
Africa/Bamako +00:00 +00:00
Africa/Bangui +01:00 +01:00
Africa/Banjul +00:00 +00:00
@danchoi
danchoi / comparison.md
Last active August 29, 2015 14:10
jsontsv vs json2csv

jsontsv vs json2csv

json2csv accepts only compact JSON input; jsontsv can accept pretty-formatted JSON input:

Input 1:

{"title":"Terminator 2: Judgment Day","year":1991,"stars":[{"name":"Arnold Schwarzenegger"},{"name":"Linda Hamilton"}],"ratings":{"imdb":8.5}}
{"title":"Interstellar","year":2014,"stars":[{"name":"Matthew McConaughey"},{"name":"Anne Hathaway"}],"ratings":{"imdb":8.9}}
@danchoi
danchoi / tmux.conf
Created October 24, 2014 18:07
tmux conf
set -g prefix C-a
bind - split-window -v
bind _ split-window -h
bind J resize-pane -D 20
bind K resize-pane -U 20
bind j resize-pane -D 5
bind k resize-pane -U 5
bind-key C-a last-window
# Set status bar
@danchoi
danchoi / sample.txt
Last active August 29, 2015 14:06
HaXml SAX example
[(N "AnalystId",264201849),(N "PersonID",22744894),(N "FirstName",Brian),(N "LastName",Purdy),(N "MiddleName",G.),(N "CurrentProFlag",true),(N "HasResearchFlag",true),(N "ContributorShortName",PI Financial Corp.),(N "EmailAddress",bpurdy@pifinancialcorp.com),(N "PhoneNumber",403-543-2823),(N "Prefix",Mr.),(N "ResearchContributorId",928),(N "Suffix",CFA, P.E.),(N "Title",Energy Services Analyst)]
[(N "AnalystId",52747961),(N "PersonID",52747958),(N "FirstName",Mark),(N "LastName",Purdy),(N "CurrentProFlag",false),(N "HasResearchFlag",true),(N "ContributorShortName",Deutsche Bank),(N "Prefix",Mr.),(N "ResearchContributorId",5),(N "Title",Equity Analyst)]
@danchoi
danchoi / LSystem.hs
Created May 28, 2014 03:11
LSystem.hs
{-# LANGUAGE OverloadedStrings #-}
module Main
where
import Data.Aeson
import Data.Maybe (fromJust)
import qualified Data.Text as T
import Data.Aeson (Value(..))
import qualified Data.HashMap.Strict as H
import Control.Applicative
import Control.Monad