Skip to content

Instantly share code, notes, and snippets.

Avatar

Yehonatan Water Man yonixw

View GitHub Profile
@yonixw
yonixw / commands.txt
Last active Nov 29, 2021
how to import pfx p7b into amazon
View commands.txt
c:\OpenSSL-Win64\bin\openssl.exe pkcs12 -in ???.pfx -out private+cert.pem -nodes
c:\OpenSSL-Win64\bin\openssl.exe pkcs7 -in <PKCSfile>.p7b -text -out chain.pem -print_certs
show cert
c:\OpenSSL-Win64\bin\openssl.exe s_client -connect www.google.com:443
@yonixw
yonixw / haproxy.config
Created Aug 23, 2021 — forked from hzbd/haproxy.config
Sample HAProxy config with logging.
View haproxy.config
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
lambda for easy s3 upload with curl
View lambda.py
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
antd full screen dialog
View main.css
@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 Apr 29, 2021
Get nginx users per day
View get.sh
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 Jun 10, 2017
Http urls for TP-Link NC250 IP Camera
View gist:62e22bf97be8fb0e373cc2f2eefba649
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
View timer.js
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const play = (i)=>{if(i==0)return; console.log('\u0007'); setTimeout(play,1000,i-1)}
rl.question("How long (min) ?", function(min) {
@yonixw
yonixw / Readme.md
Last active Nov 5, 2020
Concurrent WhatsApp Web across devices and windows
View Readme.md

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.

@yonixw
yonixw / report_bom.js
Created Oct 7, 2020
SonaType small report for ci cd
View report_bom.js
var http = require('http');
var fs = require('fs');
const { exit } = require('process');
const filename = "./bom.json"
function getReadableFileSizeString(fileSizeInBytes) {
var i = -1;
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'];
do {
@yonixw
yonixw / index.html
Last active Sep 30, 2020
Dock\Border layout problem with expending content
View index.html
<html>
<head>
<title>Dock layout problem POC</title>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<style><html>
<head>
<title>Dock layout problem POC</title><html>
<head>