Skip to content

Instantly share code, notes, and snippets.

View yonixw's full-sized avatar

Yehonatan Water Man yonixw

View GitHub Profile
@yonixw
yonixw / real diff.sh
Created November 3, 2022 15:05
Git REAL diff
* git branch -a
* git ls-files
* git diff <branchA> <branchB> -- <file>
* git diff CI_CD remote_data --
git ls-files | grep -vE "yarn\.lock|package-lock\.json" | xargs -L1 -d '\n' git --no-pager diff remotes/origin/remote_data remotes/origin/CI_CD -- >> diff.diff
@yonixw
yonixw / split_crop.sh
Created September 18, 2022 18:24
magick png image to pdf
magick convert 2.png -crop 1152x1584 +repage 2.meta-coin.pdf
@yonixw
yonixw / lambda.py
Created May 6, 2021 19:50
lambda for easy s3 upload with curl
import json
import logging
import boto3
from botocore.exceptions import ClientError
from botocore.client import Config
import os
import urllib.parse
"""
Example CURL, need put and file:
@yonixw
yonixw / 1export_kubectl.sh
Last active March 2, 2022 18:08
Export kubectl readable yamls
export ns=NAMESPACE # Change this
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
for n in $(kubectl -n $ns get -o=name pvc,configmap,serviceaccount,secret,ingress,service,deployment,statefulset,hpa,job,cronjob)
do
echo "Exporting $n..."
mkdir -p $(dirname $n)
# old # kubectl get -o=yaml --export $n > $n.yaml
kubectl -n $ns get $n -o yaml | kubectl-neat > $n.yaml
@yonixw
yonixw / fgNow.sh
Created February 23, 2022 17:35
nodejs xtrace dtrace trace performance heat map flame graph
if [ -z $1 ] || [ -z $2 ]
then
echo "Usage: [node file] [output svg]"
exit 1
fi
# https://www.brendangregg.com/blog/2014-09-17/node-flame-graphs-on-linux.html
# https://nodejs.org/en/docs/guides/diagnostics-flamegraph/
sudo perf record -e cycles:u -g -- node --interpreted-frames-native-stack --perf-basic-prof-only-functions "$1"
@yonixw
yonixw / commands.txt
Last active December 7, 2021 09:02
how to import pfx p7b into amazon
c:\OpenSSL-Win64\bin\openssl.exe pkcs12 -in ???.pfx -out private+cert.pem -nodes
c:\OpenSSL-Win64\bin\openssl.exe pkcs7 -text -out chain.pem -print_certs -in <PKCSfile>.p7b
show cert
c:\OpenSSL-Win64\bin\openssl.exe s_client -connect www.google.com:443
for /F "delims=" %a in ('dir /b /s "*.pfx"') do echo %a
for /F "delims=" %a in ('dir /b /s "*.pfx"') do c:\OpenSSL-Win64\bin\openssl.exe pkcs12 -in %a -out %a_private+cert.pem -nodes
@yonixw
yonixw / haproxy.config
Created August 23, 2021 23:39 — forked from hzbd/haproxy.config
Sample HAProxy config with logging.
global
pidfile /var/run/haproxy.pid
log 127.0.0.1 local0 info
ulimit-n 65536
defaults
mode http
clitimeout 600000 # maximum inactivity time on the client side
srvtimeout 600000 # maximum inactivity time on the server side
@yonixw
yonixw / main.css
Created May 2, 2021 08:05
antd full screen dialog
@media screen and (max-width: 800px) {
.ant-modal-mask {
animation-duration: 0s !important; /* fade */
}
.ant-modal-content {
height: 100%;
}
.ant-modal {
@yonixw
yonixw / get.sh
Last active April 29, 2021 20:58
Get nginx users per day
cat nginx_logs.txt // (docker logs with timestamps, so first col ($1) is time)
| tr -cd '\11\12\15\40-\176' // filter non ascii from bot requests
| grep "/202" // get rows with time like Apr/2021 or Jul/2020
| grep 'qp.png' // get rows which will called once per real user
| awk '{split($5,a,":"); print a[1] "\t" $2}' // print time of day and ip
| uniq -c
| sort -rn
| awk '{arr[$2]+=1} END {for (i in arr) {print substr(i,2),arr[i]}}' // Group IPs per day
@yonixw
yonixw / gist:62e22bf97be8fb0e373cc2f2eefba649
Created June 10, 2017 20:23
Http urls for TP-Link NC250 IP Camera
MJPEG (Video only without sound):
http://<user>:<B64 Pass>@10.0.0.11:8080/stream/video/mjpeg
WAV (sound only):
http://admin:YWRtaW4=@MYIP:8080/stream/audio/wavpcm
JPEG Snapshot (slower interval than MJPEG):
http://10.0.0.11:8080/stream/snapshot.jpg