Skip to content

Instantly share code, notes, and snippets.

View revenkroz's full-sized avatar
😏
It's probably fine

Oleg Koval revenkroz

😏
It's probably fine
View GitHub Profile
@revenkroz
revenkroz / twitch-spam.js
Last active October 25, 2020 21:28
Just init in the browser console and spam what you want
class Spammer {
chatInput = null;
sendButton = null;
valueSetter = null;
constructor() {
this.chatInput = document.querySelector('[data-a-target="chat-input"]');
this.sendButton = document.querySelector('[data-a-target="chat-send-button"]');
this._setupValueSetter();
}
function jsonToPhp(string) {
return string.replace(/"\ *:\ */g, '" => ').replace(/\{\s*\}/g, '[]').replace(/{/g, '[').replace(/}/g, ']');
}
@revenkroz
revenkroz / create-db-and-user.sh
Created September 24, 2020 21:04
Create USER and DB following format ${USER}_db
#!/bin/bash
if [ -z "$1" ]
then
echo "Database name is not specified."
exit
fi
USER=$1
PASS=`pwgen -s 16 1`
@revenkroz
revenkroz / get-local-ip.js
Created August 11, 2020 14:04
Get local ip
console.log(require('address').ip()); // 10.0.10.134
console.log(require('default-gateway').v4.sync()); // { gateway: '10.0.10.129', interface: null }
@revenkroz
revenkroz / copilot-apple-podcast.js
Last active October 19, 2020 12:47
copilot apple podcast url
(async function() {
const apiUrl = location.href.replace('gqru', 'api');
const apiResponse = await fetch(apiUrl);
const article = await apiResponse.json();
const publishUrl = article.metadata?.publishData?.uri || article?._embedded?.publishHistory?.uri;
if (!publishUrl) {
alert('Нет адреса для публикации');
return;
}
(function() {
function autoSend(value) {
const elem = document.querySelector('[data-a-target="chat-input"]');
const valueSetter = Object.getOwnPropertyDescriptor(elem, 'value').set;
const proto = Object.getPrototypeOf(elem);
const prototypeValueSetter = Object.getOwnPropertyDescriptor(proto, 'value').set;
if (valueSetter && valueSetter !== prototypeValueSetter) {
prototypeValueSetter.call(elem, value);
} else {
(() => {
const image = document.querySelector('.col-content img');
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
canvas.width = 800;
canvas.height = 800;
ctx.fillStyle = '#fff';
ctx.fillRect(0, 0, canvas.width, canvas.height);
@revenkroz
revenkroz / download-geoipdb.sh
Last active July 22, 2024 15:16
Script to download MaxMind DB and extract it immediately
#!/bin/sh
export GEOIP_EDITION='GeoLite2-Country'
export GEOIP_LICENCE_KEY='secret_licence_key'
export GEOIP_TMP_FILE=geoip.tar.gz
curl -sSL "https://download.maxmind.com/app/geoip_download?edition_id=${GEOIP_EDITION}&license_key=${GEOIP_LICENCE_KEY}&suffix=tar.gz" > $GEOIP_TMP_FILE && \
tar -xzf $GEOIP_TMP_FILE --wildcards "*/${GEOIP_EDITION}.mmdb" --strip=1 && \
rm $GEOIP_TMP_FILE
@revenkroz
revenkroz / replace-non-unique-lines
Created January 25, 2019 08:53
regex to replace all non-unique lines
(?sm)(^[^\r\n]*)[\r\n](?=.*^\1)