Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View yonixw's full-sized avatar

Yehonatan Water Man yonixw

View GitHub Profile
@yonixw
yonixw / fetchOnefile.js
Last active November 6, 2022 18:41
fetch onefile
const https = require("https");
function getReq(_url, _headers) {
return new Promise((ok, bad) => {
const headers = _headers || {};
let result = { status: -1, headers: {}, body: "" };
if (!_url) return bad("Please provide valid URL");
try {
@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 / 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 / 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 / timer.js
Last active November 15, 2022 14:06
Time nodejs
// moved to https://github.com/yonixw/nodejs-onefile
@yonixw
yonixw / Readme.md
Last active November 5, 2020 20:16
Concurrent WhatsApp Web across devices and windows

Info

Watch the video version : https://www.youtube.com/watch?v=IzZmIpXgZzo

This guide will let you run multiple WhatsApp-Web instances. Please note:

  • Send - every message send will happen as soon as possible
  • Read - Your phone will sync with only 1 instance at a time, to get update, you need to trigger it. My choise is to query a message info (any message)

Note: This guide is for educational porpuses only!!! It might break anyday. Use cautionally.

Step 1 - Sync secrets.