Skip to content

Instantly share code, notes, and snippets.

@alecthegeek
alecthegeek / Generate_GitSHA1_forAfile.sh
Last active September 4, 2020 10:31
Calculate Git sha1 for a file
(echo -en "blob $(wc -c < $file)\00";cat $file)|sha1sum -b | cut -d " " -f 1
or of course
git hash-object $file
@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active November 15, 2024 16:37
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
@wavezhang
wavezhang / java_download.sh
Last active November 13, 2024 02:42
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active November 16, 2024 03:47
Universal MediaCreationTool wrapper for all MCT Windows 10 versions - MOVED TO github.com/AveYo/MediaCreationTool.bat
@aiwantaozi
aiwantaozi / all_metrics.md
Last active November 24, 2022 17:39
all metrics

Cluster Metrics

cluster_memory_usage_percent

1 - sum(node_memory_MemAvailable_bytes{instance=~".*"}) by () / sum(node_memory_MemTotal_bytes{instance=~".*"}) by ()

cluster_network_transmit_packets_dropped_sum_rate

sum(node_network_transmit_drop_total{device!~"lo|veth.*|docker.*|flannel.*|cali.*|cbr.*",instance=~".*"}) by ()

cluster_cpu_load_5

sum(node_load1{instance=~".*"}) by () / count(node_cpu_seconds_total{mode="system",instance=~".*"}) by ()

cluster_cpu_user_seconds_sum_rate

sum(rate(node_cpu_seconds_total{mode!="user"}[5m])) by ()

@epcim
epcim / kubernetes_pods_docker_disk_usage.md
Last active October 23, 2024 21:48
docker disk space introspection kubernetes docker overlay

identify big pods/containers

investigage big files

DST=/mnt
find /var/lib -type f -size +1G -exec ls -lh {} \; | tee  $DST/bigfiles_var_lib_$(date "+%H%M").log
find /var/lib -type f -size +1G -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' | sort -rh > $DST/bigfiles_var_lib_$(date "+%H%M").sorted.log

misbehave processes

@himself65
himself65 / undefined
Last active May 24, 2021 07:33
Weibo
Pin 完善低龄未成年人犯罪规定
1 何炅 419151
2 买到核酸阳性食品是否会被传染 259536
3 迪丽热巴 黄景瑜 171031
4 英国疫情 113204
5 郭德纲 不收女徒弟是因为尊重 108208
6 有翡 103028
7 顶楼 71276
8 伦敦 63130
9 送你一朵小红花预售破5000万 58755
@domaingood
domaingood / cloudflare_batch.php
Created February 4, 2020 17:40 — forked from thiagotalma/cloudflare_batch.php
Cloudflare Batch Edit
<?php
// Form a list of all CF IP zones
// For each zone, grab all A records and TXT records matching $oldip
// For each matching record, update it to the new IP address
// Does not deal with paginated zone results so there's currently
// a maximum of 50 zones managed by this tool
$authemail = "YOU @ YOUR EMAIL . COM";
$authkey = "YOUR CLOUDFLARE API KEY";
@larsenv
larsenv / pbskids.py
Last active January 26, 2024 07:43
PBS Kids Video Downloader
import json
import requests
import subprocess
home = requests.get("https://content.services.pbskids.org/v2/kidspbsorg/home/").text
home = json.loads(home)
shows = {}
episodes = {}