Skip to content

Instantly share code, notes, and snippets.

View o0101's full-sized avatar
🏖️
Netscaping

Cris o0101

🏖️
Netscaping
View GitHub Profile
@o0101
o0101 / vanilla.js
Last active July 24, 2020 12:39
kinda smart
async function V(url, options, template, attachment, location = 'afterbegin', transformer = a => a) {
const s = transformer(await fetch(url, options).then(r => r.json()));
template = template.replace(/[^\\]{/g, '${'); // replace any unescaped { with ${
const h = await (new Function(`return Cook\`${template}\`;`)()); // print a template like `<a href={s.url}>{s.title}</a>`
if ( ! attachment ) return h; // can nest V functions
const e = attachment instanceof Element ? attachment : document.querySelector(attachment+'');
e.insertAdjacentHTML(h, location);
return e;
@o0101
o0101 / background.js
Created November 22, 2019 11:43 — forked from muralikg/background.js
puppeteer screen capture demo. Currently records 10 second video. Change the timeout in background.js with your own logic to stop the recording when necessary. Try with `node export.js`
/* global chrome, MediaRecorder, FileReader */
chrome.runtime.onConnect.addListener(port => {
let recorder = null
port.onMessage.addListener(msg => {
console.log(msg);
switch (msg.type) {
case 'REC_STOP':
console.log('Stopping recording')
if (!port.recorderPlaying || !recorder) {
@o0101
o0101 / install.sh
Last active November 20, 2019 19:28
Installl BGCE on new Debian instance
sudo apt update && sudo apt -y upgrade
sudo apt install -y curl git wget
git clone https://github.com/dosycorp/browsergap.ce.git
sudo apt install -y nodejs npm
sudo npm i -g npm
./setup_machine.sh
apt install build-essential pkg-config autoconf libtool unzip gtk+2.0 xserver-xorg libglu1-mesa-dev freeglut3-dev mesa-common-dev libxmu-dev libxi-dev libasound2 libasound2-plugins alsa-utils alsa-oss pulseaudio pulseaudio-utils libpulse-dev chromium-browser
http://us.download.nvidia.com/XFree86/Linux-x86_64/410.93/NVIDIA-Linux-x86_64-410.93.run
nvidia-xconfig --query-gpu-info
sudo nvidia-xconfig --busid=PCI:0:3:0 --use-display-device=none --virtual=1280x1024
nodejs
sudo usermod -aG pulse,pulse-access root
/etc/pulse/default.pa
load-module module-stream-restore restore_device=false
https://gist.github.com/jniltinho/9c009e9771651aa4a004ad3d1f6857e3
https://bitbucket.org/goempirical/bullman/get/bcc1b7ae6eb9.zip
@o0101
o0101 / install.txt
Last active October 5, 2020 16:32
BrowserGap CE install from start on fresh Debian 9
Okay, I'm not sure about the VirtualBox part, but I'm doing a fresh install from a new droplet now
and I'll list the commands I'm using 1 by 1 in order to help resolve your issue.
(btw to use nodejs v12 I usually use nvm, but I don't bother installing node 12 for root, and I will run some BG processes using sudo, which lets them use the existing node (usually 10) and I have not noticed a problem).
ssh in to droplet, get a root prompt
$ apt update && apt upgrade
(get a weird error about Debian stretch being expired, okay, moving on)
@o0101
o0101 / z.js
Last active August 28, 2020 10:25
const Z = self.Z = {
keyed: {}
}
function def({
name: name = 'Widget',
render: render = () => `<h1>Hello World</h1>`,
innerStyle: innerStyle = () => `h1 { font-family: monospace; color: dodgerblue; }`,
outerStyle: outerStyle = () => ({height:'10rem', width:'100%', display:'block'}),
keyed: keyed = false
@o0101
o0101 / zember.js
Last active August 28, 2020 10:22
Zember.js ~ components from iframes
zember installs the following function
document.createComponent(
markup,
frameStyle,
innerStyle,
code
);
And produces an iframe styles like frameStyle, with its internal document styles like frameStyle,
@o0101
o0101 / cell-masking.vba
Created October 6, 2019 14:55
cell masking with a password
'Full code on finish
'You can change H4, 6, 26, and H to other cell references
Function KeyCell() As String
KeyCell =3D "H4"
End Function
Function RowStart() As Integer
RowStart =3D 6
End Function
@o0101
o0101 / README.md
Last active August 28, 2020 10:26
Theorem∎ X Cris September 7 2019 Test

How to run this program?

Download the 3 files: index.html, flatten.js, and tests.js into 1 directory and open index.html with a web browser.

Open the JavaScript console to see test output.

@o0101
o0101 / r.js
Created September 6, 2019 02:31
Secret Brutal Code
// r.js
// imports
import {CODE,BROWSER_SIDE} from './common.js';
import {S} from './ssr.js';
import T from './types.js';
// backwards compatible alias
const skip = markup;
const attrskip = attrmarkup;