Skip to content

Instantly share code, notes, and snippets.

View iczero's full-sized avatar
🪲
i made bugs

iczero iczero

🪲
i made bugs
View GitHub Profile
const repl = require('repl');
const LeagueClientAPI = require('./lol-client-api');
const http = require('http');
const util = require('util');
// set this to the path to LeagueClient.exe (example for linux)
const LEAGUE_EXE_PATH = process.env.HOME + '/Games/league-of-legends/drive_c/Riot Games/League of Legends/LeagueClient.exe';
// options for util.inspect when formatting responses
const INSPECT_OPTS = {
depth: Infinity,
@iczero
iczero / drawer.js
Last active December 21, 2018 06:26
// dependencies: pngjs raw-socket
// part of a filing cabinet!
const ping = require('./net-ping.js');
const util = require('util');
const PNG = require('pngjs').PNG;
const fs = require('fs');
const cluster = require('cluster');
const IMAGE = 'draw.png';
const X_OFFSET = 0;
@iczero
iczero / zergrush.js
Last active November 30, 2018 20:26
const SELECTOR = '.zr_zergling_container';
/**
* Fire a mouse event on an element
* @param {Element} node
* @param {String} type
*/
function triggerMouseEvent(node, type) {
let event = document.createEvent('MouseEvent');
event.initEvent(type, true, true);
@iczero
iczero / getUrlTitle.js
Created November 30, 2018 06:28
Crappy function that gets URL title. Will fix later probably
// Passes most of the tests on http://ircbot.science/
// needs a URL regex put in the URL_REGEX variable.
// use this one if you want: https://gist.github.com/iczero/513afbc94291735a0d94a5a6d0be3827
/**
* Get title of webpage by url
* @param {String} qurl URL in question
* @param {Function} callback Callback when page title is found
* @param {Number} num Number of redirects encountered (usually 0)
* @return {void}
@iczero
iczero / urlregex.js
Last active November 30, 2018 06:27
A URL-matching regular expression
/**
* A regex that can match URLs in strings.
* Modified so they can match most of the formats people use for URLs
* and not leave out parts of URLs when not anchored.
*
* Sources:
* https://gist.github.com/dperini/729294 for the url-matching part
* https://gist.github.com/syzdek/6086792 for the IPv6 regex
*/
@iczero
iczero / build-vscode.sh
Last active April 14, 2022 13:29
Compile linux builds of VSCode from source
#!/bin/bash
# note: certain directory names have been changed to the original to
# preserve compatibility with certain extensions that do not expect
# changed directory names
export NVM_DIR="$(realpath nvm)" && (
git clone https://github.com/creationix/nvm.git "$NVM_DIR" || true
cd "$NVM_DIR"
git fetch --all
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
@iczero
iczero / scihub-nginx.conf
Last active August 13, 2020 23:30
Sci-Hub nginx reverse proxy setup
# relevant parts of configuration
upstream scihub {
server 80.82.77.83:443;
server 80.82.77.84:443;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name sci-hub.yourdomain.comt;
@iczero
iczero / ubuntu-cli-install-android-sdk.sh
Last active June 1, 2022 10:04 — forked from zhy0/ubuntu-cli-install-android-sdk.sh
Install Android SDK on headless Ubuntu linux machine via command line, so that you can compile open source Android apps.
#!/bin/bash
# Thanks to https://gist.github.com/wenzhixin/43cf3ce909c24948c6e7
# Execute this script in your home directory. Lines 17 and 21 will prompt you for a y/n
# Install Oracle JDK 8
apt install openjdk-8-jdk
# Get SDK tools (link from https://developer.android.com/studio/index.html#downloads)
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
@iczero
iczero / spam.js
Last active October 14, 2018 03:59
Fills the databases of scammers with fake email/password combinations
// spam the scammers until they're gone
// dependencies: an-array-of-english-words request blessed
const request = require('request');
const words = require('an-array-of-english-words');
const blessed = require('blessed');
const http = require('http');
const EventEmitter = require('events');
const UI_UPDATE_INTERVAL = 100;
const EMAIL_DOMAINS = [
@iczero
iczero / tirand.js
Last active November 2, 2018 18:24
an implementation of the rand() function of TI calculators in javascript
// generate TI random values and seeds
const mod1 = 2147483563;
const mod2 = 2147483399;
const mult1 = 40014;
const mult2 = 40692;
/**
* Check whether two arrays are equal to each other
* @param {Array} arr1
* @param {Array} arr2