Skip to content

Instantly share code, notes, and snippets.

@ilyaglow
ilyaglow / XMLHttpRequest_send_intercept.js
Created December 6, 2021 22:24
Intercepting XMLHttpRequest.send call by overwriting it's prototype
(function (send) {
XMLHttpRequest.prototype.send = function (body) {
console.log(body)
send.call(this, body)
}
})(XMLHttpRequest.prototype.send);
@ilyaglow
ilyaglow / watermark_doc.sh
Created August 7, 2021 07:25
Watermark you ID with ImageMagick before sending to this new shiny app
function watermark_doc {
text_top="text 10,10 '$2'"
text_bottom="text 5,15 '$2'"
output_file="${1}_watermarked_$(date +%s).jpg"
convert -size 140x80 xc:none -gravity center -fill '#80808080' \
-gravity NorthWest -draw "${text_top}" \
-gravity SouthEast -draw "${text_bottom}" \
miff:- |\
composite -tile - "$1" "${output_file}"
@ilyaglow
ilyaglow / disc.sh
Last active January 24, 2020 12:15
Simple primitive to monitor output of the command: DISC (do if something changed)
#!/bin/sh
FIRST=y
sh -c "$CMD" > .prev-output
while :
do
if [[ "$FIRST" == "y" ]]; then
FIRST="n"
sleep "$SLEEP"
# Run example:
# docker run -it --rm -e ACCESS_TOKEN=no-permissions-access-token gitgot -q '"domain.com"'
FROM python:3-alpine
LABEL maintainer "Ilya Glotov <contact@ilyaglotov.com>"
ENV SSDEEP_VERSION="release-2.14.1" \
BUILD_DEPS="build-base \
automake \
autoconf \
@ilyaglow
ilyaglow / cortex-analyzer-result-schema.json
Created June 14, 2019 15:45
Cortex Analyzer Result JSONSchema
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"required": [
"success",
"artifacts",
"summary",
@ilyaglow
ilyaglow / uac_decode.py
Created December 20, 2018 10:58
Convert userAccountControl code to the user account property flags
PROPERTY_FLAGS = [
"SCRIPT",
"ACCOUNTDISABLE",
None,
"HOMEDIR_REQUIRED",
"LOCKOUT",
"PASSWD_NOTREQD",
"PASSWD_CANT_CHANGE",
"ENCRYPTED_TEXT_PWD_ALLOWED",
"TEMP_DUPLICATE_ACCOUNT",
@ilyaglow
ilyaglow / gist:a5780255e1c13468b6c1c344cc60662f
Last active September 5, 2018 12:12
ЭЦП для госуслуг на Mac OS High Sierra
brew install opensc (?) questionable
cryptopro csp
crypto pro browser pki
cryptopro browser plugin
/opt/cprocsp/bin/csptestf -absorb -certs
/opt/cprocsp/bin/certmgr -list
package main
import (
"compress/gzip"
"flag"
"io"
"log"
"net/http"
"os"
)
@ilyaglow
ilyaglow / nginx-tuning.md
Created February 13, 2018 17:08 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

package main
import (
"bufio"
"database/sql"
"flag"
"log"
"os"
"path/filepath"
"strings"