This file contains hidden or 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
XMLHttpRequest = new Proxy(XMLHttpRequest, { | |
construct:function(t,a){ | |
const req = new t(); | |
return new Proxy(req, { | |
get:function(o,p){ | |
if(p=='status')return 9001 | |
return typeof o[p] == 'function'?o[p].bind(o):o[p] | |
}, | |
set: function(target, prop, value) { | |
Reflect.set(target, prop, value) // or target[prop] = value |
This file contains hidden or 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
# https://imququ.com/post/web-proxy.html | |
var http = require('http'); | |
var net = require('net'); | |
var url = require('url'); | |
function connect(cReq, cSock) { | |
var u = url.parse('http://' + cReq.url); | |
var pSock = net.connect(u.port, u.hostname, function() { | |
cSock.write('HTTP/1.1 200 Connection Established\r\n\r\n'); |
This file contains hidden or 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
// See https://aka.ms/new-console-template for more information | |
using System.Text; | |
using System.Text.RegularExpressions; | |
var lines = File.ReadAllLines("error.txt"); | |
var regex = new Regex(@"(C:\\workspace.+.cs)\((.+),(.+)\): Error CodeAnalyzer0001", RegexOptions.Compiled); | |
Console.WriteLine("start"); | |
var fileRowsDict = new Dictionary<string, List<int>>(); |
This file contains hidden or 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
void Update(DataRow newRow, string connStr, string tableName) | |
{ | |
using MySqlDataAdapter da = new MySqlDataAdapter( | |
$"select * from {tableName}", | |
connStr | |
); | |
da.UpdateCommand = new MySqlCommandBuilder(da).GetUpdateCommand(); | |
DataSet ds = new DataSet(); |
This file contains hidden or 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
void func() { | |
CDatabase db; | |
CRecordset rs(&db); | |
db.OpenEx("Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\\dbo.mdb;"); | |
db.ExecuteSQL("select * from Sporter"); | |
rs.Open(CRecordset::dynaset, "select * from [Sporter]", CRecordset::none); | |
BOOL a = rs.CanAppend(); |
This file contains hidden or 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
function Convert-Gbk-To-Utf8($source, $dest) { | |
$gbk = [System.Text.Encoding]::GetEncoding("gb2312") | |
$utf8 = [System.Text.Encoding]::UTF8 | |
$text = [System.IO.File]::ReadAllText($source, $gbk) | |
[System.IO.File]::WriteAllText($dest, $text, $utf8) | |
} |
This file contains hidden or 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
$roleAssignments = Get-AzRoleAssignment | |
$roles = Get-AzRoleDefinition | |
# https://docs.microsoft.com/en-us/azure/role-based-access-control/resource-provider-operations | |
$storageActionRegexList = @('^\*$', '^\*/.+$', '^Microsoft\.Storage/.+$') | |
$storageDataActionRegexList = @('^\*$', '^\*/.+$', '^Microsoft\.Storage/.+$') | |
$storageManagementAccessRoles = @() | |
$storageDataAccessRoles = @() |
This file contains hidden or 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
# ref: https://docs.microsoft.com/en-us/iis/configuration/system.applicationhost/sites/site/logfile/ | |
# ref: https://forums.iis.net/t/1205491.aspx?Add+IIS+8+5+Custom+Logging+Fields+with+Powershell | |
function Set-WebSiteIISLogFormat { | |
param ( | |
$Site | |
) | |
$logExtFileFlags = 'Date,Time,ClientIP,UserName,ServerIP,Method,UriStem,UriQuery,HttpStatus,Win32Status,TimeTaken,ServerPort,UserAgent,Referer,Host,HttpSubStatus' | |
Set-ItemProperty -Path "IIS:\Sites\$Site" -Name logfile.logExtFileFlags -Value $logExtFileFlags |
This file contains hidden or 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
--https://dba.stackexchange.com/questions/20355/generate-create-script-for-all-indexes | |
DECLARE @SchemaName VARCHAR(256)DECLARE @TableName VARCHAR(256) | |
DECLARE @IndexName VARCHAR(256) | |
DECLARE @TSQLDropIndex VARCHAR(MAX) | |
DECLARE CursorIndexes CURSOR FOR | |
SELECT schema_name(t.schema_id), t.name, i.name | |
FROM sys.indexes i | |
INNER JOIN sys.tables t ON t.object_id= i.object_id | |
WHERE i.type>0 and t.is_ms_shipped=0 and t.name<>'sysdiagrams' |
NewerOlder