Skip to content

Instantly share code, notes, and snippets.

@krokofant
krokofant / index.js
Last active Jun 17, 2019 — forked from zkat/index.js
npx is cool
View index.js
#!/usr/bin/env node
console.log('yay gist')
console.error('Error :(')
process.exitCode = 1;
View git powershell eol stats.ps1
$files = git ls-files --eol *.less *.cshtml *.html *.txt *.config *.csproj *.sln *.cs *.js *.ts *.json *.bat *.ps1 --full-name;$files | Group-Object { $_.Split('.')[-1] } | Sort Count -Descending | Format-List @{Label="crlf"; Expression={$_.Group | ? { $_ -match "i/crlf" } | % {$i=0} {$i++} {$i} }},@{Label="lf"; Expression={$_.Group | ? { $_ -match "i/lf" } | % {$i=0} {$i++} {$i} }} -GroupBy @{Name="ext";Expression={"." + $_.Name}}
View concfgColorsToWindowsTerminalProfile.js
/*Keep Order*/
const ColorMap = {
DARK_BLACK: "black",
DARK_RED: "dark_red",
DARK_GREEN: "dark_green",
DARK_YELLOW: "dark_yellow",
DARK_BLUE: "dark_blue",
DARK_MAGENTA: "dark_magenta",
DARK_CYAN: "dark_cyan",
DARK_WHITE: "gray",
View Windows10TitleBarColorsFocusInactive.reg
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM]
"Composition"=dword:00000001
"ColorizationColor"=dword:c4000000
"ColorizationColorBalance"=dword:00000059
"ColorizationAfterglow"=dword:c4000000
"ColorizationAfterglowBalance"=dword:0000000a
"ColorizationBlurBalance"=dword:00000001
"ColorizationGlassAttribute"=dword:00000001
@krokofant
krokofant / WindowsDefenderExlusions.ps1
Last active Apr 26, 2019
Exlude common programs and folders from Windows Defender
View WindowsDefenderExlusions.ps1
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
$isAdmin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
function Get-Matching-Path ($basePath, $regex) {
Get-ChildItem -Path $basePath -ErrorAction Ignore | Where-Object -FilterScript { $_.Name -match $regex } | Select-Object -Property Name | ForEach-Object { Join-Path $basePath $_.Name }
}
$paths = @()
$processes = @()
@krokofant
krokofant / pre-commit
Last active Nov 15, 2018
pre-commit hook
View pre-commit
#!/usr/bin/env sh
cd $(git rev-parse --show-toplevel)
currentBranch=$(git rev-parse --abbrev-ref HEAD)
files=$(git diff $currentBranch --name-only -G"fdescribe|fit|describe\.only|it\.only|debugger")
count=$(echo -n $files | wc -m)
if [ $count -gt 0 ]; then
echo "Found fdescribe, fit or debugger in:"
echo "$files"
exit 1
fi
@krokofant
krokofant / GitChangeFileExtension.ps1
Created Oct 25, 2018
Perform name changes with git (git mv) recursively with PowerShell
View GitChangeFileExtension.ps1
Get-ChildItem -Recurse -Include *.js | % { git mv --dry-run $_.FullName $_.FullName.replace
(".js",".ts") }
@krokofant
krokofant / android-magisk-root-certificate.md
Created Nov 21, 2017
Certificate installation as system with the use of Magisk
View android-magisk-root-certificate.md
hash=$(openssl x509 -inform PEM -subject_hash_old -in charles-ssl-proxying-certificate.pem | head -1)
mv charles-ssl-proxying-certificate.pem "$hash.0"
echo "Download magisk"
wget https://github.com/topjohnwu/magisk-module-template/archive/1400.zip

echo "Put $hash.0 into /system/etc/security/cacerts/"
echo "chmod 644 the file"
echo "zip into module and install"
View ojoc-keyhack-Dockerfile
FROM ubuntu:xenial
COPY . .
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y gcc unzip curl wget
ENTRYPOINT cd /x86 && ./decrypt.sh
View OxygenOS CallFix.xml
<TaskerData sr="" dvi="1" tv="4.9u4m">
<Task sr="task2">
<cdate>1497738763230</cdate>
<edate>1499562571055</edate>
<id>2</id>
<nme>CallFix</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>123</code>
<Str sr="arg0" ve="3">settings put global op_voice_recording_supported_by_mcc 1</Str>