Skip to content

Instantly share code, notes, and snippets.

@orlv
orlv / gist:c381153aa150270b6675c12d92ad560b
Created June 7, 2019 13:58
Fetch response intercept v2
window.OrigResponseText = window.Response.prototype.text
window.OrigResponseJSON = window.Response.prototype.text
window.Response.prototype.text = async function () {
const res = await window.OrigResponseText.apply(this, arguments)
window.lastText = {
url: this.url,
res
}
@orlv
orlv / gist:db1796a27f94fb7504f73973ebcbb378
Created June 7, 2019 13:57
Fetch response intercept v1
window.origFetch = window.fetch
window.fetch = async function () {
const response = await origFetch.apply(this, arguments)
const text = response.text.bind(response)
const json = response.json.bind(response)
response.text = async () => {
const res = await text()
window.lastRes = res
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const ArgumentParser = require('argparse').ArgumentParser
const sourceMap = require('source-map')
const parser = new ArgumentParser({
addHelp: true,
description: 'Deobfuscate JavaScript code using a source map',
@orlv
orlv / lxc.sh
Created January 11, 2019 15:23 — forked from reqshark/lxc.sh
set up linux containers with node.js
# update the host
apt-get update && apt-get upgrade -y # && apt-get dist-upgrade -y && apt-get autoremove --purge -y && apt-get autoclean -y
# https://www.stgraber.org/
# install linux containers
sudo apt-get install lxc
# list all containers and view their current status
sudo lxc-ls -f
@orlv
orlv / 00.howto_install_phantomjs.md
Created July 28, 2017 08:06 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@orlv
orlv / array-func.js
Created July 8, 2017 20:06
Array functions
'use strict'
/**
* Insert element into sorted array
* @param {number} value
* @param {Array} array
* @returns {number} - index
*/
export function insertIntoSortedArray (value, array) {
const index = locationOf(value, array)
@orlv
orlv / click.m
Created June 21, 2017 19:26
Move and click the mouse via code
// File:
// click.m
//
// Compile with:
// gcc -o click click.m -framework ApplicationServices -framework Foundation
//
// Usage:
// ./click -x pixels -y pixels
// At the given coordinates it will click and release.
@orlv
orlv / cask-upgrade
Last active September 4, 2019 10:01
Script upgrading outdated brew casks
#!/usr/bin/env bash
(set -x; brew -v update;)
(set -x; brew -v cleanup;)
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`