Skip to content

Instantly share code, notes, and snippets.

View gsw945's full-sized avatar
🙏
buddha-like coding

玖亖伍 gsw945

🙏
buddha-like coding
View GitHub Profile
@gsw945
gsw945 / move_symlinks.py
Created March 18, 2024 08:13
move symlinks from one folder to another folder on windows
@gsw945
gsw945 / pocketpy-branchs-sha256.ps1
Created November 6, 2023 10:43
pocketpy-branchs&sha256.ps1
param (
[Parameter(Mandatory=$true)][string]$BaseDir
)
# remove end Directory Separator Char
$BaseDir = $BaseDir.Trim('"', "'").TrimEnd([IO.Path]::DirectorySeparatorChar)
Write-Host "BaseDir: [${BaseDir}]"
Set-Location -Path $BaseDir
$ApiUrl = 'https://api.github.com/repos/blueloveTH/pocketpy/releases'
@gsw945
gsw945 / go-template-child.go
Last active September 5, 2023 10:10
Go text/template multiple templates demo
package main
import (
"fmt"
"html/template"
"os"
)
func main() {
const parentTemplate = `
@gsw945
gsw945 / powershell-code-snippets.md
Created July 4, 2023 03:25
PowerShell code snippets

dotnet 全局 tool 全部更新

foreach ($package in $(dotnet tool list --global | Select-Object -Skip 2)) {
    Write-Host "dotnet tool update --global $($package.Split(" ", 2)[0])"
    dotnet tool update --global $($package.Split(" ", 2)[0])
}

文件下载

@gsw945
gsw945 / gist:7897e5d5eb65f691939994a45e7b605d
Created March 27, 2023 08:48 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@gsw945
gsw945 / bitmat2ico.py
Created January 19, 2023 02:45
convert bitmat to ico
# -*- coding: utf-8 -*-
'''
convert bitmat to ico
ref: https://stackoverflow.com/questions/45507/is-there-a-python-library-for-generating-ico-files/62374154#62374154
'''
import pathlib
from PIL import Image
@gsw945
gsw945 / git-show-branch-in-bash.sh
Created June 20, 2022 09:23
git show branch in bash
# append to ~/.bashrc
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="${PS1:0:-1}\[\033[33m\]\$(parse_git_branch)\[\033[00m\] "
@gsw945
gsw945 / generate_smallest_png_base64.py
Last active January 27, 2022 07:07
generate smallest png base64 string
import base64
from io import BytesIO
from PIL import Image
def smallest_png_base64():
with Image.new('RGBA', (1, 1), (0, 0, 0, 0)) as img:
with BytesIO() as buffer:
img.save(buffer, format='PNG')
@gsw945
gsw945 / screen-keep-alive.py
Created November 20, 2021 07:24
screen-keep-alive
# -*- coding: utf-8 -*-
# sudo apt-get install python3-tk python3-dev
# pip install pyautogui
import time
import pyautogui
print('自动移动鼠标,避免锁屏')
print('按 [Ctrl + C] 退出')
print('-' * 60)
screenWidth, screenHeight = pyautogui.size()
package main
import (
"encoding/base64"
"net/http"
"net/http/httputil"
"github.com/astaxie/beego"
"github.com/astaxie/beego/context"
)