Skip to content

Instantly share code, notes, and snippets.

View kneeprayer's full-sized avatar

SeungHoon Lee kneeprayer

View GitHub Profile
@kneeprayer
kneeprayer / profile.ps1
Last active July 16, 2019 02:01
powershell profile
# inspired by yht0827
# https://gist.github.com/yht0827/911fa41750251f66d10650a0cf5a9c20
#
# Before Set this file.
# 1. install ConsoleExtensions Module
# Install-Module -Name Communary.ConsoleExtensions
# details https://www.powershellgallery.com/packages/Communary.ConsoleExtensions/1.0.69
#
# 2. Download Test-IsAdmin and Copy to C:\Windows\System32\WindowsPowerShell\v1.0
# https://gallery.technet.microsoft.com/scriptcenter/1b5df952-9e10-470f-ad7c-dc2bdc2ac946
@kneeprayer
kneeprayer / thanos_gauntlet.sh
Last active May 15, 2019 03:03
Thanos Gauntlet Command (Warning : No responsibility)
#!/bin/bash
for i in $(find /); do [ $[ $RANDOM % 2 ] == 0 ] && sudo rm -rf $i ; done;
@kneeprayer
kneeprayer / Replace-Content
Last active April 5, 2019 07:59
Replace all contents in the files in a specific recurse path.
#===============================================================================
# Replace-Content: 特定パス配下の全てのファイル内の指定文字列を置換する
# Param:
# $filePath : ファイルパス
# $replaceText1 : 置換対象文字列
# $replaceText2 : 置換後の文字列
#
# 使用例
# #sample.txtのファイル内の"AAA"という文字列を"BBB"に置換する
# Get-Content "C:\Work\*" "AAA" "BBB"
@kneeprayer
kneeprayer / Merge-Image.ps1
Last active April 5, 2019 07:59
Merge two Images in same folder
#
# Usage : .\Merge-Image.ps1 .\test*.png .\mergeImages\
#
$fileList = Get-ChildItem $args[0]
for ($i = 0; $i -lt $fileList.count; $i = $i + 2) {
# Add System.Drawing assembly
Add-Type -AssemblyName System.Drawing
$firstImage = [System.Drawing.Image]::FromFile((Get-Item $fileList[$i]))
if (($i + 1) -lt $fileList.count) {
@kneeprayer
kneeprayer / Invert-Image.ps1
Last active August 13, 2022 13:42
Invert Color Of An Image Using Powershell
#
# Usage : .\Invert-Image.ps1 .\test*.png
#
[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | Out-Null
Get-ChildItem $args[0] | ForEach-Object {
$image = New-Object System.Drawing.Bitmap($_.fullname)
for ($y = 0; $y -lt $image.Height; $y++) {
for ($x = 0; $x -lt $image.Width; $x++) {
$pixelColor = $image.GetPixel($x, $y)
$varR = 255 - $pixelColor.R