Skip to content

Instantly share code, notes, and snippets.

View nxmad's full-sized avatar

Alex Balatsky nxmad

  • Vietnam
  • 22:26 (UTC +07:00)
View GitHub Profile
if (window._bot != undefined) {
// alert('Bot added before, if something goes wrong try reload the page')
}
window._bot = true
window._martingale = 2.05
window._variant = Math.random() >= 0.5 ? 1 : 0
// window._variants = ['Roll < 49', 'Roll > 51']
<?php
namespace App\Crawlers;
use OTPHP\TOTP;
use App\Models\Item;
class MarketsCrawler extends AbstractCrawler
{
/**
let app = require('http').createServer((req, res) => {
res.writeHead(200);
res.end('!@#');
})
let io = require('socket.io').listen(app)
app.listen(process.env.WS_PORT)
let Redis = require('redis').createClient({
host: process.env.REDIS_HOST,
@nxmad
nxmad / LogirovatVremyaRegistraciiVOtdelnyObject.php
Created February 16, 2018 03:10
LogirovatVremyaRegistraciiVOtdelnyObject
<?php
use \Carbon\Carbon;
/*
* Usage eg.:
* protected function create(array $data)
* {
* (new SeparatedObject)->setRegisteredAt(Carbon::now());
*
@nxmad
nxmad / fix-sequences.sql
Created December 8, 2021 14:30
Fix all tables sequences & ownership (Postgres)
CREATE OR REPLACE FUNCTION "reset_sequence" (tablename text, columnname text, sequence_name text)
RETURNS "pg_catalog"."void" AS
$body$
DECLARE
BEGIN
EXECUTE 'SELECT setval( ''' || sequence_name || ''', ' || '(SELECT MAX(' || columnname ||
') FROM ' || tablename || ')' || '+1)';
@nxmad
nxmad / script.js
Created July 24, 2023 16:58
Simple discord.com script to leave all group DMs after some inactivity time
{
// personal discord token (can be found in cookies)
const TOKEN = ''
// inactivity threshold in days
const LEAVE_THRESHOLD = 30
const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms))
const getChannels = async () => {
const res = await fetch('https://discord.com/api/v9/users/@me/channels', {