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
console.log(angular); |
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
mongoose schema: | |
update: function(row){ | |
return this.update({}, row).exec(); | |
} | |
// method 1 | |
batchUpdate: function(rows){ | |
return Promise.map(rows, function(row){ | |
return self.update({}, row).exec(); |
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
const puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
await page.goto('https://www.fugle.tw/picture/cards?cards[]={"c":"FCRD000002","s":"2330"}'); | |
await page.waitForSelector('line.candle-stem'); | |
await page.addScriptTag({ | |
content: ` | |
d3.selectAll(".candleRect").each(function(d,i){ |
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 | |
export NEW_SSH_KEY=ssh-rsa\ ....\ user@host | |
sed -e "s#ssh-rsa.*OLD_KEY_ID#$NEW_SSH_KEY#" ~/.ssh/authorized_keys | |
# ssh root@host 'bash -s' < this_script.sh |
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
// ==UserScript== | |
// @name New Userscript | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.fugle.tw/picture/cards?cards[]={%22c%22:%22FCRD000002%22,%22s%22:%222330%22} | |
// @grant none | |
// ==/UserScript== |
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
var collectionNames = db.getCollectionNames(), stats = []; | |
collectionNames.forEach(function (n) { stats.push(db[n].stats()); }); | |
stats = stats.sort(function(a, b) { return b['size'] - a['size']; }); | |
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); } |
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
' # Show developer tab in Excel: | |
' https://spreadsheeto.com/developer-tab/ | |
' # This vba example opens IE with finance.yahoo.com website, auto clicks "Quarterly" button, and then copies all td values | |
' of financial report into "Sheet1" sheet. | |
' # Can possibly use HTTP Request alternatively: http://excelerator.solutions/2017/08/28/excel-http-get-request/ (instead of open ie) | |
Sub test() | |
Dim RowCount As Integer | |
Dim sht As Worksheet |
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
var crypto = require("crypto") | |
function encrypt(key, data) { | |
var cipher = crypto.createCipher('aes-256-cbc', key); | |
var crypted = cipher.update(text, 'utf-8', 'hex'); | |
crypted += cipher.final('hex'); | |
return crypted; | |
} |
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 | |
# /tmp/cmd = -l | |
a='$(cat /tmp/cmd)' | |
echo "ls $a" # => ls $(cat /tmp/cmd) | |
# alternatives to: | |
#eval ls $a |
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
{ | |
"openapi" : "3.0.0", | |
"info" : { | |
"title" : "Taiwan Stock Market Real-time Quotes API", | |
"description" : "### 相關說明:\n* 所有日期格式(date, time)皆以 ISO 8601 格式傳輸及實作 \n* 回傳格式參照 google json guide \n* 所有 Success Response 包含 apiVersion, { data: { info: {}}} \n* 所有 Error Response property code 同 http status code \n* 所有 Error Response Format 相同\n", | |
"contact" : { | |
"email" : "development@fugle.tw" | |
}, | |
"license" : { | |
"name" : "Apache 2.0", |
OlderNewer