Skip to content

Instantly share code, notes, and snippets.

View nixilin's full-sized avatar

nixilin

  • Shenzhen, China
View GitHub Profile
@nixilin
nixilin / git-pre-receive-hook.sh
Created September 20, 2022 08:39 — forked from caniszczyk/git-pre-receive-hook.sh
A reasonable git pre-receive-hook
#!/bin/sh
#
# For each ref, validate the commit.
#
# - It disallows deleting branches without a /.
# - It disallows non fast-forward on branches without a /.
# - It disallows deleting tags without a /.
# - It disallows unannotated tags to be pushed.
@nixilin
nixilin / gist:a6564a492f820cf71318709ce7d37a63
Created November 13, 2021 06:49 — forked from parano/gist:1868242
Excel表格密码保护的解除方法
表格受密码保护时,我们修改数据Excel弹出“您试图更改的单元格或图表受保护,因而是只读的。
若要修改受保护单元格或图表,请先使用‘撤消工作表保护’命令(在‘审阅’选项卡的‘更改’组中)来取消保护。
可能会提示输入密码。这时候我们可以用VBA宏代码破解法来破解表格保护密码:
第一步:打开该文件,先解除默认的“宏禁用”状态,方法是点击工具栏下的“选项”状态按钮,
打开“Microsoft Office安全选项”窗口,选择其中的“启用此内容”,“确定”
再切换到“视图”选项卡,点击“宏”→“录制宏”,出现“录制新宏”窗口,在“宏名”定义一个名称为:
PasswordBreaker,点击“确定”退出;
第二步:再点击“宏”→“查看宏”,选择“宏名”下的“PasswordBreaker”并点击“编辑”,
打开“Microsoft Visual Basic”编辑器,用如下内容替换右侧窗口中的所有代码:
@nixilin
nixilin / README.md
Created October 15, 2021 16:52 — forked from felixhammerl/README.md
Write TLS keys system-wide in macOS via SSLKEYLOGFILE and launchd
  1. Put tlskeylogger.plist at ~/Library/LaunchAgents/tlskeylogger.plist
  2. launchctl load ~/Library/LaunchAgents/tlskeylogger.plist, so it will load on the next restart
  3. launchctl start ~/Library/LaunchAgents/tlskeylogger.plist, so it will load the environment variable immediately
  4. Restart your browser(s)
  5. See how TLS keys are being written to ~/.tlskeyfile via tail -f ~/.tlskeyfile
@nixilin
nixilin / log-all-zsh-bash-commands-syslog.md
Created May 27, 2020 10:01 — forked from dayreiner/log-all-zsh-bash-commands-syslog.md
Log all users zsh / bash commands via syslog without 3rd-party tools or auditd

Sending Bash and ZSH Commands to Syslog

Also posted here: http://18pct.com/sending-bash-and-zsh-commands-to-syslog/

Your bash/zsh history is great if its complete, but it doesn't capture commands across all users, sudo's, root commands etc. In particular with test environments, someone may perform a "one-off" procedure and then months later it needs to be repeated. It would be nice to be able to look up what the user did at the time, and searching through multiple, possibly truncated history files is a pain.

Tools like typescript are great if you're actively documenting, but not something you would use all the time in practice and capture more than just a history of your commands. There are third-party tools like rootsh and Snoopy that can accomplish this, but third-party tools can be overkill if all you want is a quick reference in a re

com.cloudbees.plugins.credentials.SystemCredentialsProvider.getInstance().getCredentials().forEach{
it.properties.each { prop, val ->
if (prop == "secretBytes") {
println(prop + "=>\n" + new String(com.cloudbees.plugins.credentials.SecretBytes.fromString("${val}").getPlainData()) + "\n")
} else {
println(prop + ' = "' + val + '"')
}
}
println("-----------------------")
}