Skip to content

Instantly share code, notes, and snippets.

View amphineko's full-sized avatar
🍊
Have a job but do open-source when not busy

amphineko amphineko

🍊
Have a job but do open-source when not busy
  • 05:06 (UTC)
View GitHub Profile
@amphineko
amphineko / lock-and-sleep.ps1
Created July 22, 2019 19:34
PowerShell script to lock workstation and turn off monitor
<#
This PowerShell script locks your current session, then immediately turns off your monitor.
You don't have to wait for or alter your screen timeout,
or use a sleep button set to turning off monitor that doesn't exist on your computer.
#>
$LockWorkStation = Add-Type -Name "Win32LockWorkStation" -PassThru -MemberDefinition @"
@amphineko
amphineko / knot-dynamic-update.md
Created March 4, 2019 10:51
Using Dynamic Update with Knot DNS

Using Dynamic Update with Knot DNS

Step 1: Generate a TSIG key

You will use a TSIG key to authenticate yourself to your Knot server.

Using keymgr shipped in knot-dnsutils (for Debian releases) makes it simple.

keymgr -t <tsig_name> [<algorithm>] [<bits>]
@amphineko
amphineko / hosts.discord
Last active December 10, 2018 12:29
essential (maybe?) servers for discord, queried from choopa
;; SERVER: 108.61.10.10#53(108.61.10.10)
;; WHEN: Mon Dec 10 12:25:54 UTC 2018
104.16.251.144 dl.discordapp.net
104.16.247.144 dl.discordapp.net
104.16.250.144 dl.discordapp.net
104.16.248.144 dl.discordapp.net
104.16.249.144 dl.discordapp.net
104.16.59.37 gateway.discord.gg
104.16.60.37 gateway.discord.gg
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
ssl_dhparam /etc/nginx/dhparam.pem;
ssl_ecdh_curve secp384r1;
ssl_prefer_server_ciphers on;
# SSL Session Cache
ssl_session_cache shared:SSL:60m;
ssl_session_timeout 1d;
@amphineko
amphineko / node-sass install.md
Last active September 26, 2016 05:26
yet another memo of installing node-sass

Retrieve node.js version and convert to release number at Previous releases page. v6.6.0 is 48.

> node -v
v6.6.0

Retrieve the binding binary at node-sass-binaries.

win32-x64-48_binding.node

Set a environment variable to define binding file to be used by node-sass.

@amphineko
amphineko / keybase.md
Last active September 29, 2017 10:30

Keybase proof

I hereby claim:

  • I am amphineko on github.
  • I am amphineko (https://keybase.io/amphineko) on keybase.
  • I have a public key whose fingerprint is AC59 C058 BDE0 C8BE 617B D953 5544 3BA3 09CB 6D53

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am amphineko on github.
  • I am amphineko (https://keybase.io/amphineko) on keybase.
  • I have a public key whose fingerprint is F116 5EFE 07DD DC22 65D8 EA70 401F 9696 2B93 8D6D

To claim this, I am signing this object:

/*
Luna Capsule / vijos-1045
Problem: https://vijos.org/p/1045
Record: https://vijos.org/records/54413c5817f3ca0e15b0a872
- 一道裸MST(最小生成樹)的題目
Kruskal+路徑壓縮的並查集即可被Accepted, #8與#9測試點需要特別注意 (见代码注释)
*/
/*
Luna Capsule / vijos-1057
Problem: https://vijos.org/p/1057
Record: https://vijos.org/records/53ff29a048c5fc314f8b4571
- 一道很水的DP题, 方程f[i][j] = min(f[i - 1][j - 1], f[i][j - 1], f[i - 1][j])
自行设计复杂一点的数据手工模拟一下DP过程就可以得到方程
*/
/*
Luna Capsule / vijos-1022
Problem: https://vijos.org/p/1022
Record: https://vijos.org/records/53f36e2c48c5fc437d8b4574
- Create adjacency list (double-way) with the input,
BFS nodes and mark them, skip visited node when selecting the next node for BFSing.
*/