Skip to content

Instantly share code, notes, and snippets.

@o0101
o0101 / on_testing.md
Created September 30, 2021 13:05
My testing philosophy

On testing

  • fast feedback loop
  • set up your code so you can see it working. e.g dev server, CI/CD
  • code with imagination
    • (you're constantly thinking of edge caes naturally and places where things can go wrong, and coding defensively, or at least with awareness)
  • dogfooding, test by using
  • think of it as a product, test it from the user interaction
@o0101
o0101 / sysctl.conf
Created August 14, 2021 06:39 — forked from kgriffs/sysctl.conf
Linux Web Server Kernel Tuning
# Configuration file for runtime kernel parameters.
# See sysctl.conf(5) for more information.
# See also http://www.nateware.com/linux-network-tuning-for-2013.html for
# an explanation about some of these parameters, and instructions for
# a few other tweaks outside this file.
#
# See also: https://gist.github.com/kgriffs/4027835
#
# Assumes a beefy machine with lots of network bandwidth
@o0101
o0101 / CLA.md
Last active August 9, 2021 09:41
DOSYAGO CLA

DOSYAGO SOFTWARE CONTRIBUTOR ASSIGNMENT AGREEMENT

This Dosyago Contributor Agreement (this "Agreement") applies to any Contribution you make to any Work. This is a binding legal agreement on you and any organization you represent. If you are signing this Agreement on behalf of your employer or other organization, you represent and warrant that you have the authority to agree to this Agreement on behalf of the organization.

1. Definitions.

  • "Contribution" means any original work, including any modification of or addition to an existing work, that you submit to Dosyago in any manner for inclusion in any Work, including software source code, object code, documentation, or other material.
  • "Dosyago", "we", and "us" means The Dosyago Corporation (equivalently and variously, “Dosyago”, “DOSYCORP”, “Dosy”).
  • "Work" means any project, work, or materials owned or managed by Dosyago.
function z(n) {
const T = 0.00001
let lastT = 0; let L = Math.log(n);
while(Math.abs(lastT-L) > T) { lastT = L;
L = Math.log(n)/Math.log(L);
}
return L;
}
this is sort of the natural base of any number
@o0101
o0101 / script-template.sh
Created December 15, 2020 12:07 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
trap cleanup SIGINT SIGTERM ERR EXIT
usage() {
cat <<EOF
@o0101
o0101 / gist:b52c5a1808548b991c22857e358db61c
Created October 31, 2020 15:09 — forked from kurokikaze/gist:350fe1713591641b3b42
install chrome from powershell
(new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', 'c:/temp/chrome.exe');. c:/temp/chrome.exe /silent /install;rm c:/temp -rec
@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