Skip to content

Instantly share code, notes, and snippets.

View mephistoc's full-sized avatar

Vincent Chu mephistoc

  • AgilePoint
  • Taiwan
View GitHub Profile
SELECT sp.stats_id,
name,
filter_definition,
last_updated,
rows,
rows_sampled,
steps,
unfiltered_rows,
modification_counter
FROM sys.stats AS stat
SELECT 'ALTER INDEX [' + ix.name + '] ON [' + s.name + '].[' + t.name + '] ' +
CASE
WHEN ps.avg_fragmentation_in_percent > 15
THEN 'REBUILD'
ELSE 'REORGANIZE'
END +
CASE
WHEN pc.partition_count > 1
THEN ' PARTITION = ' + CAST(ps.partition_number AS nvarchar(MAX))
ELSE ''
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')
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
@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.
@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 / 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 / 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
<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>
<!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>