Skip to content

Instantly share code, notes, and snippets.

@bryanknox
bryanknox / .editorconfig
Last active Aug 30, 2021
.editorconfig for C# Visual Studio projects
View .editorconfig
# EditorConfig is awesome: https://EditorConfig.org
#
# More info about editorconfig for C# and .NET in Visual Studio see:
# https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019
#
# Most of the .NET and C# rules below were taken from the
# Microsoft Roslyn team's editorconfig at:
# https://github.com/dotnet/roslyn/blob/master/.editorconfig
# Top-most EditorConfig file.
View MSSQL executed query history
USE master
go
SELECT sdes.database_id
,sdes.[host_name]
,sdes.[program_name]
,sdes.login_name
,sdes.login_time
,sdec.client_net_address
,sdec.local_net_address
,sdest.Query
@oguzalb
oguzalb / interpret.py
Created Apr 17, 2020
A simple stack machine implementation for Python in Python
View interpret.py
import dis
# Run this with python3 : )
class VM:
def __init__(self):
self.stack = []
def push(self, value):
self.stack.append(value)
def pop(self):
return self.stack.pop()
@premek
premek / mv.sh
Last active Jul 5, 2021
Rename files in linux / bash using mv command without typing the full name two times
View mv.sh
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@gokulkrishh
gokulkrishh / useful-npx-commands.md
Last active Nov 30, 2021
List of useful npx (Node Package Runner) commands (https://git.io/useful-npx-commands)
View useful-npx-commands.md

NPX (NPM Package Runner) Commands

List of useful npx (NPM Package Runner) commands.

What is NPX?

Using NPX we can execute/run node binaries without the need to install it locally or globally.

Commands

@ninhanh
ninhanh / WAHH_Task_Checklist.md
Created Jun 28, 2019 — forked from gbedoya/WAHH_Task_Checklist.md
The Web Application Hacker's Handbook - Task Checklist - Github-Flavored Markdown
View WAHH_Task_Checklist.md
@wybiral
wybiral / noscript-tracking.go
Last active Oct 23, 2021
Tracking cursor position in real-time with remote monitoring (without JavaScript)
View noscript-tracking.go
// Tracking cursor position in real-time without JavaScript
// Demo: https://twitter.com/davywtf/status/1124146339259002881
package main
import (
"fmt"
"net/http"
"strings"
)
View Reflaction
1. A General Fast Method Invoker (https://www.codeproject.com/Articles/14593/A-General-Fast-Method-Invoker)
public static FastInvokeHandler GetMethodInvoker(MethodInfo methodInfo)
{
DynamicMethod dynamicMethod = new DynamicMethod(string.Empty,
typeof(object), new Type[] { typeof(object),
typeof(object[]) },
methodInfo.DeclaringType.Module);
ILGenerator il = dynamicMethod.GetILGenerator();
ParameterInfo[] ps = methodInfo.GetParameters();
Type[] paramTypes = new Type[ps.Length];
@CleanCoder
CleanCoder / Task Extension
Last active Apr 8, 2020
Task Extension
View Task Extension
static async Task<T> Otherwise<T> (this Task<T> task, Func<Task<T>> orTask) {
task.ContinueWith (async innerTask => {
if (innerTask.Status == TaskStatus.Faulted)
return await orTask ();
return await Task.FromResult<T> (innerTask.Result);
}).Unwrap ();
}
static async Task<T> Retry<T> (Func<Task<T>> task, int retries, TimeSpan delay, CancellationToken cts = default (CancellationToken)) {
View WinDBG
1) 准备工作
.loadby sos clr
.cordll -ve -u -l
.load <<path>>\sosex.dll
.load <<path>>\mex.dll
.symfix
.reload
2) 常用方法
!pe [<exceptionAddr>] most recent exception data (don’t forget the external stack)