Skip to content

Instantly share code, notes, and snippets.

View xiongnemo's full-sized avatar
🧧

Nemo Xiong xiongnemo

🧧
View GitHub Profile
@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 / 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 / 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 / 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