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
#!/bin/bash | |
set +o pipefail | |
#if [ -z "${1}" ]; then | |
# echo "Which version?" | |
# exit -1 | |
#fi | |
# version=$1 | |
# Get current installed version |
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
#!/bin/bash | |
# 目的:自動刪除變更時間超過七天的檔案 | |
# 環境: | |
# 1. NAS 有開放 FTP | |
# 2. host, username, password 放在 /etc/login.cfg ,格式遵循 ncftp 規定,內容大致如下 | |
# host your_host | |
# user your_user | |
# pass your_pass | |
set -e |
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/python3 | |
players = [ | |
['james', 202], | |
['curry', 193], | |
['durant', 205], | |
['jordan', 199], | |
['david', 211]] | |
players_iter = iter(players) |
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
# -*- coding: utf-8 -*- | |
"""Convert each words capital in string.""" | |
from __future__ import print_function | |
from argparse import ArgumentParser | |
def convert_each_word_capital(s): | |
"""Convert each words capital in string.""" | |
words = s.split(" ") | |
capitaled_words = map(lambda x: x.capitalize(), words) |
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
#!/bin/bash | |
# 使用 streamer 以 webcam 抓圖,存為 0000.jpeg ... 40000.jpeg | |
# 再使用 avconv 將圖片轉換為影片 | |
streamer -o 0000.jpeg -s 352x288 -j 100 -t 4000 -r 1 | |
avconv -r 10 -i %04d.jpeg -r 10 -vcodec libx264 -crf 20 -g 15 timelapse.mp4 |
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/python3 | |
# Tested in Ubuntu 14.04 | |
# Requirement packages: | |
# - sudo apt install python3-requests | |
import sys | |
import argparse | |
import json | |
import requests | |
import subprocess |
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
#!/bin/bash | |
VERSION=${1:-3.0.0-rc1} | |
wget http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/${VERSION}/swagger-codegen-cli-${VERSION}.jar -O swagger-codegen-cli.jar |
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
#!/bin/bash | |
TOPDIR=$(git rev-parse --show-toplevel) | |
DESTDIR="/your_artifacts_folder" | |
ARTIFACT_FILE="${DESTDIR}/your_project.zip" | |
MODIFIED_FILES=$(git ls-files -m ${TOPDIR}) | |
if [ ! -z "${MODIFIED_FILES}" ]; then | |
echo "Please commit first!" | |
exit -1 | |
fi | |
CURRENT_BRANCH=$(git branch | grep \* | cut -d ' ' -f2-) |
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
class Foo: | |
def call(self, msg): | |
print(self.__class__, msg) | |
class Single: | |
def call(self, msg): | |
Foo.call(self, msg) | |
Single().call('hello') | |
""" |
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 python | |
# -*- coding: utf-8 -*- | |
class employee: | |
def __init__(self, name): | |
self.name = name | |
def __str__(self): | |
return "{clsname}(name={name})".format( | |
clsname=self.__class__.__name__, |