Skip to content

Instantly share code, notes, and snippets.

View memory_leak.php
php -r 'ini_set("memory_limit","-1");$a=[];for($i=0;;++$i){echo "leaked {$i}MB\r";$a[]=random_bytes(1*1024*1024);}';
@divinity76
divinity76 / emergency_diskspace.sh
Last active Jul 9, 2022
emergency_diskspace.sh
View emergency_diskspace.sh
screen -S emergency_diskspace -dm
sleep 1 # workaround https://savannah.gnu.org/bugs/?54164
screen -S emergency_diskspace -X stuff '
mkdir /emergency_diskspace;
cd /emergency_diskspace;
for i in {0..9}
do
echo creating 10gb_\$i
dd if=/dev/urandom of=10gb_\$i bs=10M count=1000 iflag=fullblock status=progress;
done
@divinity76
divinity76 / bitbucket_ignore_pr_userscript.js
Last active Jun 30, 2022
bitbucket ignore pull request userscript for GreaseMonkey / ViolentMonkey / TamperMonkey
View bitbucket_ignore_pr_userscript.js
// ==UserScript==
// @name Bitbucket ignore pull request - bitbucket.org
// @namespace divinity76
// @include /^https\:\/\/bitbucket\.org\//
// @grant none
// @version 1.0
// @author -
// @description screenshot: https://user-images.githubusercontent.com/1874996/175759481-27eb41c5-6874-44f1-a428-d195a7bcbab8.png - 6/26/2022, 1:10:55 AM
// ==/UserScript==
@divinity76
divinity76 / dreamhost.sh
Last active May 19, 2022
dreamhost account init script..
View dreamhost.sh
#fix unicode
[[ -z $(grep LANG ~/.bash_profile) ]] && echo '[[ -z "${LANG}" ]] && export LANG='\''en_US.UTF-8'\''' >> ~/.bash_profile
#make sure .bashrc is loaded on ssh login
[[ -z $(grep bashrc ~/.bash_profile) ]] && echo 'source ~/.bashrc' >> ~/.bash_profile
# create gems (bin) dir
mkdir -p ~/.gems/bin;
# install screenie
wget 'https://gist.github.com/divinity76/1a583968c997869b27a5ee2c1ed24259/raw/76453e61a92676386589fbb3f4ef0225ac98fb19/screenie.b64' -O- | base64 -d > ~/.gems/bin/screenie ; chmod 0555 ~/.gems/bin/screenie;
# install ncdu
wget 'https://github.com/divinity76/static_bin/blob/static_ncdu/ncdu?raw=true' -O ~/.gems/bin/ncdu; chmod 0555 ~/.gems/bin/ncdu;
View Quest_Cavebot.txt
setMeleeKill Buff
setMeleeKill Undead Warlock
setMeleeKill Lizard Templar
setMeleeKill Mad Wolf
setAvoidFront Mad Wolf
setMeleeKill Sesto Elemento
setMeleeKill Crazy Eye
setAvoidFront Crazy Eye
setMeleeKill Apocalypse
setAvoidFront Apocalypse
View python_complaints.md

just started trying Python, and..

1: Python doesn't have constants. you can't do

class C {
  const FOO=123;
}

in Python. (however "constants" are conventionally ALL_UPPERCASE, and linters may complain if you're modifying an ALL_UPPERCASE)

@divinity76
divinity76 / get_all_github_repos.js
Created Mar 30, 2022
get all github repos of user
View get_all_github_repos.js
function get_all_github_repos_of_user(user) {
let extractedRepos = [];
let wget = function(url) {
let xhr = new XMLHttpRequest();
xhr.open("GET", url, false);
(xhr.send());
return xhr.responseText;
};
let domparser = function(html) {
return (new DOMParser()).parseFromString(html, "text/html");
View ipv4_scanner.php
<?php
declare(strict_types=1);
$ip_range_start = 0;
$ip_range_start = ip2long("0.5.0.0");
$ip_range_end = 0xFFFFFFFF;
if (0) {
$ip_range_start = ip2long("45.62.204.200");
$ip_range_end = ip2long("45.62.204.230");
}
View tibia_broadcast.php
<?php
declare(strict_types=1);
$message = 'Looking for people to join lvl 350 armor quest. meet us at lvl 350 door in premium area 12:15! (UTC+2/Poland time)';
$hostname = "tibiafun.zapto.org";
$port = 7171;
$account = 123;
$password = "?";
$charname = "Stupid Broadcaster";
broadcast_headless($message, $hostname, $port, $account, $password, $charname);
@divinity76
divinity76 / aliexpress_total_cost.js
Last active Mar 24, 2022
aliexpress total cost userscript
View aliexpress_total_cost.js
// ==UserScript==
// @name New script - aliexpress.com
// @namespace Violentmonkey Scripts
// @match https://www.aliexpress.com/item/\d*.html
// @grant none
// @version 1.0
// @author -
// @description 3/24/2022, 5:28:33 PM
// ==/UserScript==