Skip to content

Instantly share code, notes, and snippets.

View hellwolf's full-sized avatar

Miao ZhiCheng hellwolf

View GitHub Profile
@hellwolf
hellwolf / supervisord
Last active August 29, 2018 12:29
/etc/init.d/supervisord for `pip install supervisor` supervisor@^3.3.4
#!/bin/bash
#
# supervisord This scripts turns supervisord on
#
# Author: Mike McGrath <mmcgrath@redhat.com> (based off yumupdatesd)
# Jason Koppe <jkoppe@indeed.com> adjusted to read sysconfig,
# use supervisord tools to start/stop, conditionally wait
# for child processes to shutdown, and startup later
# Cameron Kerr <cameron.kerr.nz@gmail.com> adjusted 'status'
# to return an LSB-compliant return code so things like
@hellwolf
hellwolf / add-watermark.sh
Created December 3, 2016 15:46
ImageMagick command: add water mark to picture
composite -dissolve 30% -gravity southwest ../utilities/roth_emblem_105_bordered.png fed-assets-2003-2016.png fed-assets-2003-2016-marked.png
@hellwolf
hellwolf / sync.gs
Created November 10, 2016 09:34
sync.gs
function GetSyncListItems(serviceInstanceId, listId, accountSid, authToken) {
var url = "https://preview.twilio.com/Sync/Services/" + serviceInstanceId + "/Lists/" + listId + "/Items";
var result = ImportJSON(url, "", "", accountSid, authToken);
return result;
}
@hellwolf
hellwolf / ImportJSON.gs
Created November 10, 2016 08:32
ImportJSON.gs with username/password support
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
===== geth-dev
#!/bin/bash
exec geth \
--datadir "C:\Users\zhimiao\AppData\Roaming\Ethereum.dev" \
--password "C:\Users\zhimiao\AppData\Roaming\Ethereum.dev\dev.passwordfile" \
--dev \
"$@"
@hellwolf
hellwolf / spawn.js
Last active December 29, 2015 19:27
[NodeJS] Spawn a child process and write a pid file
!/usr/bin/env node
var spawn = require('child_process').spawn;
var fs = require('fs');
var c = spawn(process.argv[3], process.argv.slice(4), { stdio: 'inherit' });
if (c.pid) {
pidFile = fs.createWriteStream(process.argv[2]);
pidFile.write(c.pid.toString());
@hellwolf
hellwolf / test-extended-key.js
Created December 8, 2015 15:35
using bitcoinjs-lib and test hardended/non-hardened extended keys concepts
var bitcoin = require('bitcoinjs-lib');
var network = bitcoin.networks.bitcoin;
var privateSeed = 'f9b64acde29b65ea8909f33380a7e87dc5f07b9437891cb8a0ef0e6fedc775e7fab0c846d45afb226c08d373f55a21c025410ee5a168a57000a8db9e8e3a29cb';
console.log("privateSeed", privateSeed);
var master = bitcoin.HDNode.fromSeedHex(privateSeed, network);
// derive hardened node and its neutered version
var hardenedNode = deriveAccount(master, 0);
var hardenedNeutered = hardenedNode.neutered();
var hardenedBase58 = hardenedNeutered.toBase58();
@hellwolf
hellwolf / gist:21f52fa7af3e5ab00ab8
Created September 30, 2015 21:16
configure PyDev unittest file pattern
Run configuration ->
Python unittest ->
(one of the configuration) ->
Arguments ->
PyUnit: Override PyUnit preferences for this launch?
--include_files 'integration_*.py'
@hellwolf
hellwolf / gist:45a468509dc6b4b01874
Created January 2, 2015 18:23
getParameterByName
function getParameterByName(name) {
'use strict';
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=?([^&#]*)"),
results = regex.exec(location.search);
return results === null ? null : decodeURIComponent(results[1].replace(/\+/g, " "));
}
@hellwolf
hellwolf / gist:8584504
Created January 23, 2014 18:51
Apache VirtualHosts and ProxyPass
NameVirtualHost *
# default vhost
<VirtualHost *>
DocumentRoot /
</VirtualHost>
# www.snailattach.com
<VirtualHost *>
ServerName www.example.com