Skip to content

Instantly share code, notes, and snippets.

@henryjuan
henryjuan / Config.sol
Created August 4, 2020 14:09
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=true&gist=
pragma solidity >=0.4.22 <0.7.0;
/**
* @title Config
* @dev Set and get settings
*/
contract Config {
address private owner;
@henryjuan
henryjuan / jail.local
Created August 26, 2017 02:50 — forked from Nihisil/jail.local
Send notifications to the Slack from fail2ban
...
action_with_slack_notification = %(banaction)s[name=%(__name__)s, port="%(port)$
slack[name=%(__name__)s]
action = %(action_with_slack_notification)s
...
@henryjuan
henryjuan / transfer.fish
Created June 28, 2017 01:34 — forked from nl5887/transfer.fish
Bash and zsh alias for transfer.sh. Transfers files and directories to transfer.sh.
function transfer
if test (count $argv) -eq 0
echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
end
## get temporarily filename, output is written to this file show progress can be showed
set tmpfile ( mktemp -t transferXXX )
## upload stdin or file
@henryjuan
henryjuan / boc_twd_rate.js
Created October 10, 2016 09:52
利用 nightmare 取中銀報價
var Nightmare = require('nightmare');
var nightmare = Nightmare({ show: true });
nightmare
.goto('http://www.boc.cn/sourcedb/whpj')
.select('html body div.wrapper div.BOC_main div.publish div div#DefaultMain.main form#historysearchform div.invest_t table tbody tr td select#pjname', '2895')
.click('html body div.wrapper div.BOC_main div.publish div div#DefaultMain.main form#historysearchform div.invest_t table tbody tr td input.search_btn')
.wait(2000)
.evaluate(function () {
return document.querySelector('table:first-child tr.odd').innerText;
})
@henryjuan
henryjuan / query-transasia-fare.sh
Created July 4, 2014 11:01
簡化查詢復興航空機票價格流程
簡化查詢復興航空機票價格流程
@henryjuan
henryjuan / parse-transasia-fare-page.js
Created July 4, 2014 11:00
從復興航空訂位購票網頁取出資料
從復興航空訂位購票網頁取出資料
function createPost() {
var userId = 'me';
var msg = '使用 Google Apps Script 發消息+圖片';
var img = 'https://developers.google.com/apps-script/images/carousel0.png';
var blob = UrlFetchApp.fetch(img).getBlob().setContentTypeFromExtension();
var media = PlusDomains.newMedia();
var result = PlusDomains.Media.insert(media, userId, 'cloud', blob);
@henryjuan
henryjuan / gist:9129773
Created February 21, 2014 06:30
Transparent 1x1 GIF:
// Transparent 1x1 PNG:
header('Content-Type: image/png');
echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=');
// Transparent 1x1 GIF:
header('Content-Type: image/gif');
echo base64_decode('R0lGODlhAQABAJAAAP8AAAAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==');
@henryjuan
henryjuan / gist:5441360
Created April 23, 2013 06:53
痞客邦留言表單下方的 JavaScript
<script type="text/javascript">
<!--
(function($){
var pixform = {};
pixform.confirm_popup = false;
// 偵測是瀏覽器是否支援 input 的 placeholder 屬性
var tmp = document.createElement('input');
pixform.usePlaceholder = false;
@henryjuan
henryjuan / gist:5301064
Created April 3, 2013 13:09
前端开发者使用 jQuery Templates plugin
<script id="tmpl-timeline" type="text/x-jquery-tmpl">
<div class="timeline-day">
<div class="timeline-day-date {{= classToday}}">
<div class="timeline-day-vbar"></div>
<div class="timeline-day-date-numbers">
<strong>{{= sDate.substr(0,4)}}<br>
<strong class="datelarge">{{= sDate.substr(5,5)}}</strong></strong>
</div>
</div>
<div class="timeline-day-thumbs">