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://docs.mergestat.com/blog/2022/01/01/a-year-in-commits | |
mergestat "SELECT author_email, count(DISTINCT hash) AS commit_count \ | |
, round(count(DISTINCT hash) / (SELECT count(DISTINCT hash)+0.0 FROM commits, stats('', commits.hash) WHERE parents < 2 AND file_path not like '%/apis/%' AND strftime('%Y', author_when) = '2024') * 100, 2) as '%' \ | |
, SUM(additions) AS total_additions \ | |
, round(SUM(additions) / (SELECT SUM(additions)+0.0 FROM commits, stats('', commits.hash) WHERE parents < 2 AND file_path not like '%/apis/%' AND strftime('%Y', author_when) = '2024') * 100, 2) as '%' \ | |
, SUM(deletions) AS total_deletions \ | |
, round(SUM(deletions) / (SELECT SUM(deletions)+0.0 FROM commits, stats('', commits.hash) WHERE parents < 2 AND file_path not like '%/apis/%' AND strftime('%Y', author_when) = '2024') * 100, 2) as '%' \ | |
, count(DISTINCT file_path) AS files_changed \ | |
, round(count(DISTINCT file_path) / (SELECT COUNT(DISTINCT file_path)+0.0 FROM commits, stats('', commits.hash) WHERE parents < 2 AND file_path no |
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
<?xml version="1.0" encoding="utf-8"?> | |
<Project> | |
<Target Name="PublishHash" AfterTargets="AfterPublish"> | |
<ItemGroup> | |
<FilesToHash Include="$(PublishDir)**" Exclude="$(PublishDir)*.sha256;" /> | |
</ItemGroup> | |
<GetFileHash Files="@(FilesToHash)" Algorithm="SHA256"> | |
<Output TaskParameter="Items" ItemName="Hashes" /> | |
</GetFileHash> |
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
[ -f /tmp/mnt/DDL/D/tomato/syncthing-linux-arm/syncthing ] && /tmp/mnt/DDL/D/tomato/syncthing-linux-arm/syncthing --gui-address=192.168.2.1:8384 --home=/tmp/mnt/DDL/D/tomato/syncthing-linux-arm/home | |
#>/tmp/mnt/DDL/D/tomato/syncthing-linux-arm/log.txt 2>&1 |
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
public static DbString ToDbString<T>(this string value, string key, bool? IsFixedLength, int? MaxLength, bool? IsAnsi) | |
{ | |
var property = typeof(T).GetProperty(key); | |
var attrLength = property?.GetCustomAttributes<StringLengthAttribute>().SingleOrDefault(); | |
var maxLength = MaxLength ?? attrLength?.MaximumLength ?? DbString.DefaultLength; | |
var attrAnsi = property?.GetCustomAttributes<UnicodeAttribute>().SingleOrDefault(); | |
var isAnsi = IsAnsi ?? attrAnsi?.IsUnicode switch | |
{ |
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
type Shape<T, K extends keyof T> = { [key in K]?: yup.ISchema<T[key]> | ReturnType<typeof yup.ref<T[key]>> }; | |
export type YupObjectType<T> = Pick<T, keyof T>; | |
export type YupObjectShape<T> = Shape<T, keyof T>; | |
// Usage: yup.object<YupObjectType<T>, YupObjectShape<T>>({ ... }) |
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
if (!window.isSecureContext) import("navigator.locks"); | |
async function lockThenRun<T>(name: string, callback: (lock: Lock | null) => Promise<T>) { | |
return await window.navigator.locks | |
.request(name, { ifAvailable: true }, async (lock) => { | |
if (lock === null) throw new DOMException("The lock was not granted."); | |
await new Promise((resolve) => setTimeout(resolve, Math.random() * 100)); | |
return lock; | |
}) | |
.then(callback) |
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
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\chromeurl] | |
@="URL:Google Chrome Protocol" | |
"URL Protocol"="" | |
[HKEY_CLASSES_ROOT\chromeurl\Shell] | |
[HKEY_CLASSES_ROOT\chromeurl\Shell\Open] | |
[HKEY_CLASSES_ROOT\chromeurl\Shell\Open\Command] | |
@="cmd /V /C \"set \"URL=%1\" && set URL=!URL:^&=^^^&! && set URL=!URL:chromeurl://=! && cmd /c \"start chrome !URL!\" \"" | |
; chromeurl://https://www.google.com/search?q=google&oq=google |
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
// Ref1: https://www.mvdis.gov.tw/m3-emv-plate/webpickno/queryPickNo | |
// Ref2: http://tanzih.blogspot.com/2013/09/4-80-80-yw-6675-6675-80-83.html | |
// Step0: Fill the form and Reset storage in `Ref1` | |
localStorage.removeItem("plates") | |
// Step1: Keep running until ERROR (final page) | |
localStorage.setItem( | |
"plates", | |
JSON.stringify( |
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
#! python3 | |
import base64, binascii, json, urllib.request | |
s1 = 'Hello, World!' | |
code = base64.b64encode(binascii.hexlify(s1[::-1].encode('utf-8'))).decode('utf-8') | |
s2 = bytes.fromhex(base64.b64decode(code).decode('utf-8')).decode('utf-8')[::-1] | |
assert s1 == s2 | |
link = json.loads(urllib.request.urlopen("https://file.io", data='text={}'.format(code).encode('utf-8')).read())['link'] | |
link = base64.b64encode(link.encode('utf-8')).decode('utf-8') |
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
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit } | |
Get-AppxPackage -AllUsers | where-object { | |
$_.name -notlike "*Store*" -And | |
$_.name -notlike "*Calculator*" -And | |
$_.name -notlike "*ScreenSketch*" | |
} | Remove-AppxPackage | |
Write-Host -NoNewLine 'Press any key to continue...'; | |
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown'); |
NewerOlder