Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View imfht's full-sized avatar
🎯
Focusing

imfht imfht

🎯
Focusing
View GitHub Profile
estest2017.malconmikami-fe20.aivencloud.com
kafka-2d42b206.geisenhut-9f20.aivencloud.com
grafana-31cce7e7.sre-a5b0.aivencloud.com
influx-e21823b.sre-a5b0.aivencloud.com
idbs-ecs-prod-us.sre-a5b0.aivencloud.com
grafana-2d97d3bd.ravekee-cec0.aivencloud.com
grafana-2ab8b991.systems-a3f0.aivencloud.com
influx-25c186bf.systems-a3f0.aivencloud.com
info-tlab034052.influx-25c186bf.systems-a3f0.aivencloud.com
kafka-prod.phx-prod-1.aivencloud.com
// from https://stackoverflow.com/a/45537886/8591480
CREATE FUNCTION is_valid_utf8(bytea) RETURNS boolean
LANGUAGE plpgsql AS
$$BEGIN
PERFORM convert_from($1, 'UTF8');
RETURN TRUE;
EXCEPTION
WHEN character_not_in_repertoire THEN
RAISE WARNING '%', SQLERRM;
RETURN FALSE;
@imfht
imfht / why_so_many_vuln.md
Created February 22, 2022 03:21
why_so_many_vuln.md
cna total_vul total_company most_common_company total_product most_common_product
CybersecurityCOE@eaton.com 6 1 eaton(6) 3 intelligent_power_
@imfht
imfht / why_so_many_vuln.md
Created February 22, 2022 03:20
why_so_many_vuln.md
#!/bin/sh
ipmi_host=idrac
ipmi_user=root
ipmi_passwd=xxxx
temp_threshold="60"
get_value=`ipmitool -I lanplus -H $ipmi_host -U $ipmi_user -P $ipmi_passwd sensor reading "Temp" | cut -d "|" -f 2 | cut -d " " -f 2`
if [[ $get_value > $temp_threshold ]]
then
for i in `seq 2002 2020`
do
wget https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-$i.json.gz && gunzip nvdcve-1.1-$i.json.gz
done
package main
import (
"bytes"
"fmt"
"net"
"runtime"
"sync"
"sync/atomic"
"time"
import socket
import struct
import sys
from netaddr import IPNetwork
pkt = b'\x00\x00\x00\xc0\xfeSMB@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$\x00\x08\x00\x01\x00\x00\x00\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00x\x00\x00\x00\x02\x00\x00\x00\x02\x02\x10\x02"\x02$\x02\x00\x03\x02\x03\x10\x03\x11\x03\x00\x00\x00\x00\x01\x00&\x00\x00\x00\x00\x00\x01\x00 \x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\n\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00'
subnet = sys.argv[1]
for ip in IPNetwork(subnet):
@imfht
imfht / pyspark_cos_qcloud_example.py
Created April 14, 2020 01:30
A example show how to use cos with pyspark
import os
from pyspark import SparkContext
# first you'll need download hadoop-cos-x.x.x-shaded.jar at -> https://github.com/tencentyun/hadoop-cos
os.environ[
'PYSPARK_SUBMIT_ARGS'] = './hadoop-cos-2.8.5-shaded.jar pyspark-shell'
sc = SparkContext(appName="wordCount").getOrCreate()
# some basic configuration, find more at https://cloud.tencent.com/document/product/436/6884
@imfht
imfht / iso_3166.json
Created October 17, 2019 10:20
chinese to iso 3166 code.
{"阿富汗": "AF", "奥兰群岛": "AX", "阿尔巴尼亚": "AL", "阿尔及利亚": "DZ", "美属萨摩亚": "AS", "安道尔": "AD", "安哥拉": "AO", "安圭拉": "AI", "南极洲": "AQ", "安提瓜和巴布达": "AG", "阿根廷": "AR", "亚美尼亚": "AM", "阿鲁巴": "AW", "澳大利亚": "AU", "奥地利": "AT", "阿塞拜疆": "AZ", "巴哈马": "BS", "巴林": "BH", "孟加拉国": "BD", "巴巴多斯": "BB", "白俄罗斯": "BY", "比利时": "BE", "伯利兹": "BZ", "贝宁": "BJ", "百慕大": "BM", "不丹": "BT", "玻利维亚": "BO", "波黑": "BA", "博茨瓦纳": "BW", "布维岛": "BV", "巴西": "BR", "英属印度洋领地": "IO", "文莱": "BN", "保加利亚": "BG", "布基纳法索": "BF", "布隆迪": "BI", "柬埔寨": "KH", "喀麦隆": "CM", "加拿大": "CA", "佛得角": "CV", "开曼群岛": "KY", "中非": "CF", "乍得": "TD", "智利": "CL", "中国": "CN", "圣诞岛": "CX", "科科斯(基林)群岛": "CC", "哥伦比亚": "CO", "科摩罗": "KM", "刚果(布)": "CG", "刚果(金)": "CD", "库克群岛": "CK", "哥斯达黎加": "CR", "科特迪瓦": "CI", "克罗地亚": "HR", "古巴": "CU", "塞浦路斯": "CY", "捷克": "CZ", "丹麦": "DK", "吉布提": "DJ", "多米尼克": "DM", "多米尼加": "DO", "厄瓜多尔": "EC", "埃及": "EG", "萨尔瓦多": "SV", "赤道几内亚": "GQ", "厄立特里亚": "ER", "爱沙尼亚": "EE", "埃塞俄比亚": "ET", "福克兰群岛(马尔维纳斯)": "FK", "法罗群岛": "FO", "斐济": "FJ", "芬兰": "FI", "法国": "FR", "法属圭亚那": "GF"