This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set background=dark | |
set number | |
highlight LineNr ctermfg=blue | |
syntax on | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set smarttab | |
set autoindent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import requests | |
import json | |
from datetime import datetime | |
ip = requests.get('https://icanhazip.com').text.strip() | |
cf_endpoint = 'https://api.cloudflare.com/client/v4/' | |
cf_apitoken = 'Bearer <Your API Token>' | |
# You can get <zone id> on CloudFlare dashboard |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Reference: https://stackoverflow.com/questions/18215389/how-do-i-measure-request-and-response-times-at-once-using-curl | |
curl_format="\ | |
%{time_namelookup}:\ | |
%{time_connect}:%{time_appconnect}:\ | |
%{time_pretransfer}:%{time_redirect}:\ | |
%{time_starttransfer}:%{time_total}" | |
curl_result=$(echo "$curl_format" | curl -s -o /dev/null -w @- $@) | |
IFS=':' read -r -a array <<< "$curl_result" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cow = document.querySelector('div.game') | |
for (let y = 0; y < cow.clientHeight; y += 25) | |
for (let x = 0; x < cow.clientWidth; x += 25) | |
cow.dispatchEvent(new MouseEvent('click', {clientX: x, clientY: y})); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.io.ObjectInputStream; | |
import java.io.ObjectOutputStream; | |
import java.io.Serializable; | |
import java.util.Base64; | |
class JavaSerializationDemo { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class App { | |
public static void main(String[] args) throws IOException { | |
final String result = runPython("script.py", "arg1", "arg2"); | |
System.out.println(result); | |
} | |
private static String runPython(String script, String... args) throws IOException { | |
List<String> newArgs = new ArrayList<>(); | |
newArgs.add(script); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#sudo lastb -ai | head -n-2 | awk '{print$NF}' | awk '/[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+/{print}' | sort -t. -k1,1n -k2,2n -k3,3n -k4,4n | uniq --count | awk '$1>9{print$2}' > failed.ip.9 | |
sudo lastb -ai | head -n-2 | awk '{print$NF}' | awk '/[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+/{print}' | sort | uniq --count | awk '$1>9{print$2}' > failed.ip.9 | |
for ip in $(cat failed.ip.9); do | |
sudo firewall-cmd --permanent --zone=public --add-rich-rule="rule family='ipv4' source address='$ip' reject" | |
done | |
sudo firewall-cmd --reload |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.214.215.236 | |
2.57.122.186 | |
2.135.239.123 | |
5.39.29.252 | |
5.101.151.83 | |
5.135.181.53 | |
5.135.224.152 | |
5.189.167.107 | |
13.65.190.193 | |
13.70.1.39 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BUG: cursor will disappear after open tmux | |
function cursor_green { printf '%b' '\e]12;green\a'; } | |
# cursor_green | |
# print escape character when login will cause SCP malfunction | |
# SSH auto-reconnect | |
# https://backreference.org/2013/04/26/ssh-auto-reconnect/ | |
function ssh { | |
while true; do | |
command ssh "$@"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Clear terminal history buffer | |
{ "key": "ctrl+l", "command": "workbench.action.terminal.clear", "when": "terminalFocus" }, | |
// Change ctrl+m from toggle tab focus mode to send carrage return | |
{ "key": "ctrl+m", "command": "workbench.action.terminal.sendSequence", "when": "terminalFocus", "args": {"text":"\r"} }, | |
// Change ctrl+f from find to send acknowledgement character | |
{ "key": "ctrl+f", "command": "workbench.action.terminal.sendSequence", "when": "terminalFocus", "args": {"text":"\u0006"} }, | |
] |