Skip to content

Instantly share code, notes, and snippets.

View xiongnemo's full-sized avatar

Nemo Xiong xiongnemo

  • 122.199.30.0/24 || 128.250.0.0/16
  • 10:51 (UTC +11:00)
View GitHub Profile
@xiongnemo
xiongnemo / wifi_passwd.ps1
Created September 9, 2020 12:51
Powershell script revealing saved WLAN passwords (https://twitter.com/Intel80x86/status/1303636194589372416)
(netsh wlan show profiles) | `
Select-String ":(.+)$"| `
%{$name=$_.Matches.Groups[1].Value.Trim(); $_} | `
%{(netsh wlan show profile name=$name key=clear)} | `
Select-String "Key Content\W+\:(.+)$" | `
%{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | `
%{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} | `
Format-Table -AutoSize
@xiongnemo
xiongnemo / statusCodes
Last active September 11, 2020 07:52 — forked from IngmarBoddington/statusCodes
HTTP Status Codes / Verbs List
CONNECT
DELETE
GET
HEAD
OPTIONS
PATCH
POST
PUT
TRACE
@xiongnemo
xiongnemo / generate_hql.py
Created March 22, 2021 05:46
Generate Hive QL: select distinct unioned columns from given Elasticsearch index
import json
import sys
SLIENT = "set silent=on;\n"
DROP_TABLE_TEMPLATE = "DROP TABLE IF EXISTS {};\n"
CREATE_TABLE_TEMPLATE = """
create EXTERNAL TABLE {} (
{}
)
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
@xiongnemo
xiongnemo / gitlab_scraper.bash
Created March 24, 2021 04:05
Gitlab scraper: all public/internal user's repo
#!/bin/bash
# bash ./gitlab_scraper.bash <your gitlab private token> <gitlab instance base>
# make sure you have jq and git installed
# use ssh_url_to_repo instead of http_url_to_repo to clone with ssh scheme
PRIVATE_TOKEN=$1
GITLAB_BASE=$2
# Gitlab do not have an endpoint that return total user count.
# so we have to manually instruct the script to crawl given PAGE_COUNT of users.
PAGE_COUNT=114514
for (( page=1; page<=$PAGE_COUNT; page++ )); do
@xiongnemo
xiongnemo / crop_pic.py
Created April 12, 2021 18:32
Crop pics in list supplied according to left-upmost and right-downmost points
from PIL import Image
with open("list.txt", "r", encoding='utf-8') as input_file_path_list_file:
input_file_path_list = input_file_path_list_file.readlines()
for input_file_path in input_file_path_list:
input_file_path = input_file_path.strip()
if input_file_path.strip() == "":
continue
current_img = Image.open(input_file_path)
@xiongnemo
xiongnemo / keybase.md
Created May 4, 2021 15:18
Keybase Identity

Keybase proof

I hereby claim:

  • I am xiongnemo on github.
  • I am xiongnemo (https://keybase.io/xiongnemo) on keybase.
  • I have a public key whose fingerprint is AC20 0ACC BA7D BECC 12F4 B254 5B17 18C8 29F1 AC95

To claim this, I am signing this object:

@xiongnemo
xiongnemo / get_cpu_temperature.sh
Created February 20, 2022 08:25
Get cpu temperature for raspi
sudo vcgencmd measure_temp
#/bin/sh
# $1: file (/tmp/ubuntu-20.04.3-desktop-amd64.iso)
# $2: device (/dev/sda)
sudo dd bs=4M if=$1 of=$2 conv=fdatasync status=progress
#/bin/sh
HID_MULTITOUCH_DEVICE_PATH=/sys/bus/hid/drivers/hid-multitouch/
ls HID_MULTITOUCH_DEVICE_PATH | grep ":" | xargs echo > $HID_MULTITOUCH_DEVICE_PATH/unbind
#!/bin/sh
# $1: new hostname
hostname $1
echo $1 > /etc/hostname
echo "127.0.1.1 "$1 >> /etc/hosts
hostnamectl set-hostname $1