Skip to content

Instantly share code, notes, and snippets.

View lingsamuel's full-sized avatar
🌌
Busy

Sarasa Kisaragi lingsamuel

🌌
Busy
View GitHub Profile
@lingsamuel
lingsamuel / kittens.js
Last active April 16, 2022 23:07
Kittens Game (zh) automation, theme Grey
starClick = setInterval(function() { $("#observeBtn").click(); }, 2 * 1000);
autoCraft = setInterval(function() {
craftable = res=>(res.value / res.maxValue) > 0.95;
// 炼木梁
resWood = gamePage.resPool.get('wood')
if(craftable(resWood)) {
gamePage.craftAll('beam');
@lingsamuel
lingsamuel / eldenring_dataviewer.ps1
Last active March 23, 2022 10:07
eldenring dataviewer, original created by Wulf2K
# $ErrorActionPreference= 'silentlycontinue'
$procname = "eldenring"
cls
Function RBytes
{
Param (
$addr,
$sizetoread
@lingsamuel
lingsamuel / steamcost_money.js
Created November 28, 2021 11:21
steamcost_money.js
var a = Array.from(this.document.getElementsByClassName('wallet_table_row'));
var buy = a.filter(x => {let t = x.children[1].textContent; return !(t.includes('货币转换') || t.includes('社区市场') || t.includes('钱包资金'));})
var result = {}; buy.forEach(x=>{let price = x.children[3].textContent.trim().split(' '); let refundFactor = x.children[1].textContent.includes('退款') ? -1 : 1; if(price[0] in result) {result[price[0]] += refundFactor*parseFloat(price[1]);} else {result[price[0]] = refundFactor*parseFloat(price[1]);}});
result;
@lingsamuel
lingsamuel / changes-calculate.sh
Created October 21, 2021 14:24
Calculate changes in git
git log --shortstat --since "2020-10-08" | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed", files, "; lines inserted:", inserted, "; lines deleted:", deleted}'
@lingsamuel
lingsamuel / gen_cert.sh
Last active July 20, 2021 01:26
cert_generator
#!/bin/bash
set -ex
DIR="certs" # 证书存放目录
DAYS=365 # 有效期
ORG_NAME=${ORG_NAME:-"ORG_NAME"}
ORG_UNIT=${ORG_UNIT:-"ORG_UNIT"}
CA_CN=${CA_CN:-"CA_CN"}
USER_CN=${USER_CN:-"USER_CN"}
@lingsamuel
lingsamuel / steamcost.js
Created May 7, 2021 03:32
Steam cost to CSV file
console.log(Array.from(document.querySelectorAll('.wallet_table_row'))
.filter(x => !(x.children[2].textContent.includes('退款') || x.children[2].textContent.includes('转换') || x.children[1].textContent.includes('钱包资金')))
.map(x => { return {
date: x.children[0].innerText,
cost: x.children[3].innerText,
item: x.children[1].innerText.split("\n").join(' 和 ') }
})
.filter(x => x.cost.startsWith("¥"))
.map(x => { return {
date: x.date,
Markdown 3 hrs 43 mins ██████▏░░░░░░░░░░░░░░ 29.3%
Go 3 hrs 8 mins █████▏░░░░░░░░░░░░░░░ 24.7%
Bash 2 hrs 22 mins ███▉░░░░░░░░░░░░░░░░░ 18.6%
HTML 58 mins █▌░░░░░░░░░░░░░░░░░░░ 7.7%
JavaScript 51 mins █▍░░░░░░░░░░░░░░░░░░░ 6.7%
@lingsamuel
lingsamuel / changemac@.service
Created December 23, 2020 04:54
mac changer unit file: systemctl enable changemac@eth0
[Unit]
Description=Change mac for %I
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
[Service]
Type=oneshot
ExecStart=/usr/bin/macchanger --mac=aa:bb:cc:dd:ee:ff %I
@lingsamuel
lingsamuel / kubectl-life-saver.md
Last active January 14, 2021 02:31
Kubectl shortcut aliases and a interactive command builder
@lingsamuel
lingsamuel / .zshrc
Created March 26, 2020 06:10
Oh-My-Zsh paste slow solution
# https://github.com/zsh-users/zsh-autosuggestions/issues/238#issuecomment-389324292
# This speeds up pasting w/ autosuggest
# https://github.com/zsh-users/zsh-autosuggestions/issues/238
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}
pastefinish() {
zle -N self-insert $OLD_SELF_INSERT