Skip to content

Instantly share code, notes, and snippets.

Avatar

Yehonatan Water Man yonixw

View GitHub Profile
@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
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>
View search.txt
VSCODE - JS?
Android Stduio - Java?
xCode - ioS?
doxygen
[?] Visual Studio Ext
* https://marketplace.visualstudio.com/items?itemName=YaobinOuyang.CodeAtlas
* C/C++(Tested) Python,Java,C#(Not Tested yet)
* Other languages that __doxygen__ supports:
@yonixw
yonixw / convert.bat
Created Jun 18, 2020
ImageMagick Webtoon black reigon remover
View convert.bat
REM TO C#
REM https://www.imagemagick.org/discourse-server/viewtopic.php?t=33531
SET f=31.jpg
REM Pencil:
REM convert -size 256x256 xc: +noise Random -virtual-pixel tile -motion-blur 0x20+135 -charcoal 1 pencil_tile.gif
REM Get the black