Skip to content

Instantly share code, notes, and snippets.

@snt
snt / .vimrc.fragment.vim
Last active August 29, 2015 14:20
xml format with `space,f` using Python
autocmd FileType xml map <Space>f :%!python -c "from xml.dom import minidom; import sys, io; istr=io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8'); print(minidom.parse(istr).toprettyxml(indent=' '))"
@snt
snt / node-jose-example.ipynb
Last active February 20, 2023 09:58
encrypt and decrypt using symmetric key with `node-jose`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@snt
snt / splitmoview.py
Created January 7, 2018 05:36
split movies longer than 180 seconds for flickr upload.
#!/bin/env python3
# run like this: `find ~/Desktop/exporting/*.{mp4,mov} | python3 ~/bin/splitmovies.py`
import fileinput
import subprocess
import math
SPLIT_SECONDS = 180
@snt
snt / wlp-loose-application-xml.sh
Created March 17, 2018 03:07
Generate loose application XML of WebSphere Liberty Profile.
#!/bin/sh
# https://www.ibm.com/support/knowledgecenter/ja/SS7K4U_liberty/com.ibm.websphere.wlp.zseries.doc/ae/rwlp_loose_applications.html
# put its content into apps/application-name.war.xml
TMDIR=$(cd dirname $0; echo $PWD)
cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>