This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Trevor Sullivan <trevor@trevorsullivan.net> | |
export VERSION='v9.12.0' | |
export FILENAME="balena-cli-$VERSION-linux-x64" | |
export URL="https://github.com/balena-io/balena-cli/releases/download/$VERSION/$FILENAME.zip" | |
sudo apt update | |
sudo apt install httpie unzip --yes | |
cd $HOME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import re | |
def download_file(url): | |
local_filename = url.split('/')[-1] | |
r = requests.get(url, stream=True) | |
with open(local_filename, 'wb') as f: | |
for chunk in r.iter_content(chunk_size=1024): | |
if chunk: | |
f.write(chunk) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Licensed under WTFPL or the Unlicense or CC0. | |
# This uses Python 3, but it's easy to port to Python 2 by changing | |
# strings to u'xx'. | |
import itertools | |
def num2chinese(num, big=False, simp=True, o=False, twoalt=False): |