Skip to content

Instantly share code, notes, and snippets.

View neopunisher's full-sized avatar
🎯
Focusing

Carter Cole neopunisher

🎯
Focusing
View GitHub Profile
let tokens = [];
let dsl = new Proxy({}, {
get(state, token) {
// Before anything, we're going to try and access a variable
if (tokens.length === 0 && state[token] !== undefined) {
return state[token];
}
tokens.push(token);
const rule = grammar[tokens[0]];
(function(url1, url2, url3, inj) {
inj(url1).then(() => inj(url2)).then(() => inj(url3)).then(async function() {
var canvas = document.createElement('canvas')
var ctx = canvas.getContext('2d');
const net = await posenet.load();
var processfn = async function(video, dt) {
ctx.drawImage(video, 0, 0);
@neopunisher
neopunisher / injectPico.js
Last active May 18, 2018 19:55
inject pico face detect
(function(){var urls = Array.from(arguments), inj = urls.pop();Promise.all(urls.map(inj)).then(function(){
var initialized = false;
var canvas = document.createElement('canvas')
document.body.appendChild(canvas)
var button = document.createElement('button')
function lines(elem, limit = 3, delimiter = ' '){
const width = elem.clientWidth
const words = elem.innerText.split(delimiter)
const ctx = document.createElement('canvas').getContext('2d'),
fnt = window.getComputedStyle(elem).getPropertyValue('font')
ctx.font = fnt
@neopunisher
neopunisher / inject-react.js
Last active January 22, 2021 06:42
Pull react into the page
(function(inj){
inj('https://unpkg.com/react@16/umd/react.development.js').then(()=>inj('https://unpkg.com/react-dom@16/umd/react-dom.development.js')).then(()=>inj('https://unpkg.com/babel-standalone@6.15.0/babel.min.js')).then(function(){
var out=document.createElement("div");out.id='testing';
document.body.appendChild(out)
console.log('loaded babel')
Babel.registerPlugin('eval_wrapper', function eval_wrapper() { return {visitor: {
FunctionDeclaration(path) {
console.log('a func')
// debugger
},
@neopunisher
neopunisher / 2017-linux-cheatsheet.sh
Last active August 15, 2023 14:37
my latest version
iw list #list interface capabilities
sudo iotop -aP
fc-list #list fonts
curl -L -w "time_namelookup: %{time_namelookup}\ntime_connect: %{time_connect}\ntime_appconnect: %{time_appconnect}\ntime_pretransfer: %{time_pretransfer}\ntime_redirect: %{time_redirect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" https://example.com/
@neopunisher
neopunisher / recover_source_code.md
Created March 13, 2017 19:34 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@neopunisher
neopunisher / captureYoutubeFrame.js
Last active May 18, 2018 00:26
grabs a frame out of youtube
(function(z){
var a=z.querySelector("video"),b=z.createElement("canvas"),c=b.getContext("2d"),d=z.createElement("a");b.width=a.videoWidth;b.height=a.videoHeight;c.drawImage(a,0,0);d.download="FileName.png";d.href=b.toDataURL();z.body.appendChild(d);d.click();z.body.removeChild(d);
})(document)
@neopunisher
neopunisher / 0-react-hello-world.md
Created August 13, 2016 20:27 — forked from danawoodman/0-react-hello-world.md
React Hello World Examples

React "Hello World" Examples

Below are a small collection of React examples to get anyone started using React. They progress from simpler to more complex/full featured.

They will hopefully get you over the initial learning curve of the hard parts of React (JSX, props vs. state, lifecycle events, etc).

Usage

You will want to create an index.html file and copy/paste the contents of 1-base.html and then create a scripts.js file and copy/paste the contents of one of the examples into it.

@neopunisher
neopunisher / keyboard-keymap.json
Created June 26, 2016 20:39
stolen from http://keycodes.atjayjo.com with ```obj = {};Array.from(document.querySelectorAll('#keyboard key')).forEach(function(n){ eval('obj[n.textContent] = ' + JSON.stringify(n.dataset)) })```
{
"esc": {
"key": "27",
"encode": "%1B",
"encodecaps": "%1B",
"clipboardAction": "copy",
"clipboardTarget": "#codebox input"
},
"F1": {
"key": "112",