Skip to content

Instantly share code, notes, and snippets.

View mephistoc's full-sized avatar

Vincent Chu mephistoc

  • AgilePoint
  • Taiwan
View GitHub Profile
@mephistoc
mephistoc / 0_reuse_code.js
Created March 23, 2016 03:31
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mephistoc
mephistoc / CreateTestAccnt.ps1
Created August 9, 2016 03:55
Create a bunch of local user account for test or training on Windows with predefined un secure password.
$userCnt = 1
$targetNumber = 60
do{
$currentCnt = $userCnt.ToString().PadLeft(2,"0")
$strCommand = "net user user$currentCnt `"p@ssw0rd`" /add"
iex $strCommand
#$strCommand
$userCnt++
}while($userCnt -le $targetNumber)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<!--<script src="/SharedResources/Javascript/APPlugins/filemanager.js"></script>-->
<script type="text/javascript">
document.write('<script type="text/javascript" src="/SharedResources/Javascript/APPlugins/filemanager.js?' + new Date().getTime() + '"><' + '/script>');
</script>
<script>
<html>
<head>
<link rel="stylesheet" href="Styles/font-awesome.min.css">
<link rel="stylesheet" href="Styles/bootstrap.min.css">
<link rel="stylesheet" href="Styles/jquery.json-viewer.css">
<script src="/SharedResources/Javascript/jQuery/jquery-1.8.3.js"></script>
<script type="text/javascript" src="/SharedResources/Javascript/ExternalPlugins/cookies.js"></script>
<script type="text/javascript" src="/SharedResources/Javascript/ExternalPlugins/underscore.js"></script>
<script type="text/javascript" src="/SharedResources/Javascript/APPlugins/sessionManager.js"></script>
@mephistoc
mephistoc / ethminer help.txt
Created June 29, 2017 04:34
ethminer 0.11.0 help
Usage ethminer [OPTIONS]
Options:
Work farming mode:
-F,--farm <url> Put into mining farm mode with the work server at URL (default: http://127.0.0.1:8545)
-FF,-FO, --farm-failover, --stratum-failover <url> Failover getwork/stratum URL (default: disabled)
--farm-retries <n> Number of retries until switch to failover (default: 3)
-S, --stratum <host:port> Put into stratum mode with the stratum server at host:port
-FS, --failover-stratum <host:port> Failover stratum server at host:port
-O, --userpass <username.workername:password> Stratum login credentials
@mephistoc
mephistoc / DHT11_Adafruit_sample.py
Created December 4, 2018 07:22
Example for capture and publish temperature and humidity value from DHT sensor on Raspberry Pi with Adafruit Python library.
#!/usr/bin/python
import sys
import time
import Adafruit_DHT
import requests
import json
def main():
try:
while True:
@mephistoc
mephistoc / round-robin_autoLookup.js
Created December 6, 2018 16:36
Trigger an Auto Lookup every 10 seconds in eForm #AgilePoint
/*
* Auto trigger an Auto Lookup every 10 seconds.
* 2018-Dec-07, Vincent Chu, AgilePoint Taiwan
*/
// Wire round-robin schedule on form load completed.
eFormEvents.onFormLoadComplete = function ()
{
setInterval(TriggerPIRAutoLookup, 10000);
}
@mephistoc
mephistoc / stamp.svg
Last active September 2, 2019 08:30
Align Texts to Center for Stamp in SVG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
SELECT S.name as 'Schema',
T.name as 'Table',
I.name as 'Index',
DDIPS.avg_fragmentation_in_percent,
DDIPS.page_count
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS DDIPS
INNER JOIN sys.tables T on T.object_id = DDIPS.object_id
INNER JOIN sys.schemas S on T.schema_id = S.schema_id
INNER JOIN sys.indexes I ON I.object_id = DDIPS.object_id
AND DDIPS.index_id = I.index_id
SELECT OBJECT_NAME(dt.object_id) as [TableName] , --資料表名稱
si.name as [IndexName] , --索引名稱
dt.avg_fragmentation_in_percent, --邏輯片段的百分比 (索引中失序的頁面)。
dt.avg_page_space_used_in_percent
FROM
(SELECT object_id ,
index_id ,
avg_fragmentation_in_percent,
avg_page_space_used_in_percent
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, 'DETAILED')