Skip to content

Instantly share code, notes, and snippets.

View kfstorm's full-sized avatar
🤷‍♂️
It works on my computer.

Kai Yang kfstorm

🤷‍♂️
It works on my computer.
View GitHub Profile
$r1 = "Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall"
$r2 = "Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall"
$r3 = "Registry::HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
$r4 = "Registry::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
(Dir $r1) + (Dir $r2) + (Dir $r3) + (Dir $r4) | where {$_.GetValue("SystemComponent") -ne 1}| where {$_.GetValue("ParentDisplayName") -eq $null} | %{$_.GetValue("DisplayName")} | sort -Unique
pause
$files = Get-ChildItem -Recurse | Where-Object {!$_.PSIsContainer} | Where-Object { $_.Name -match '^(.*)((?<!(\.g|\.i))\.cs|\.xaml|\.c|\.cpp|\.h)$' }
Select-String -Path $files -Pattern "[a-zA-z]+://[^\s""]+" -AllMatches | % { $_.Matches.Groups[0].Value } | select $_ -Unique | sort
$rootPath = "D:\Advertiser"
$deleteFileBefore = New-Object -typename System.DateTime -argumentlist (2013,12,25,0,0,0)
$root = New-Object -typename System.IO.DirectoryInfo -argumentlist $rootPath
foreach ($file in $root.GetFiles(“*”, [System.IO.SearchOption]::AllDirectories))
{
if ($file.LastWriteTime -le $deleteFileBefore)
{
echo ("Deleting", $file.FullName -join " ");
@kfstorm
kfstorm / vmoptions
Created June 11, 2015 05:24
IntelliJ IDEA font rendering options for Windows
-Dawt.useSystemAAFontSettings=lcd
-Dswing.aatext=true
@kfstorm
kfstorm / DetectBOMInBatchFiles.ps1
Created July 18, 2015 14:54
Detect BOM in batch files
[byte[]] $WrongBytes = 0x00,0xEF,0xFE,0xFF
Get-ChildItem -Include *.bat,*.cmd -Recurse | ForEach-Object {
$content = Get-Content $_ -Encoding Byte
if ($WrongBytes.Contains($content[0]))
{
echo $_.FullName
}
}
import shutil
import os
import re
# This is the directory of https://github.com/kfstorm/leetcode-1/tree/master/solution
dest_dir = "../leetcode-1/solution"
dest = {int(re.match(r'^\d+', d).group(0)): os.path.join(dest_dir, d) for d in os.listdir(dest_dir) if os.path.isdir(os.path.join(dest_dir, d))}
# This is the directory of https://github.com/kfstorm/LeetCode
src_dir = "."
@kfstorm
kfstorm / comment.py
Last active March 13, 2022 09:08 — forked from bveeramani/comment.py
Script to comment on all open Ray pull requests.
import time
import os
from github import Github
MESSAGE = """
## :bangbang: ACTION REQUIRED :bangbang:
We've updated our formatting configuration for C++ code. (see #22725)