Skip to content

Instantly share code, notes, and snippets.

@thenoseman
thenoseman / vue-test-watchers.js
Last active July 13, 2020 19:49
How to test watchers in vue
it("calls #loadCities if the zipCode is correct and there are 1+ chars in the field", async () => {
// This is how to test watchers:
// 1. set the starting data if neccessary
wrapper.setData({ searchTermCity: "", address: { zipCode: "12345" } });
// 2. Change the current value
wrapper.vm.searchTermCity = "Ha";
// 3. Manually trigger watcher since vue-test-utils doesn't do that anymore:(
wrapper.vm._watchers.find(w => w.expression === "searchTermCity").run();
expect(wrapper.vm.loadCities).toHaveBeenCalledWith("Ha");
});
@thenoseman
thenoseman / openssh-build-static.sh
Created December 23, 2018 11:07 — forked from fumiyas/openssh-build-static.sh
Build OpenSSH with static linked zlib and OpenSSL libraries
#!/bin/sh
set -u
set -e
umask 0077
prefix="/opt/openssh"
top="$(pwd)"
root="$top/root"
build="$top/build"
@thenoseman
thenoseman / openssh-build-static.sh
Created December 23, 2018 11:07 — forked from fumiyas/openssh-build-static.sh
Build OpenSSH with static linked zlib and OpenSSL libraries
#!/bin/sh
set -u
set -e
umask 0077
prefix="/opt/openssh"
top="$(pwd)"
root="$top/root"
build="$top/build"

Installing libcurl with Updated OpenSSL Support

If your Linux distribution is so out of date that you can no longer install updated patches, you'll typically need to either reach for an unsupported package or install the software via source. Additionally, I didn't want to interfere with installed software in fear of rendering the system unusable.

Become Root and Grab Tarballs

You're going to be installing stuff that requires root access, so it's easier to just be able to do it when you want without having to worry about using sudo and permissions. Be careful you don't delete anything you can't recover

$ sudo su - 
@thenoseman
thenoseman / cmjcu-tinylily-digispark-clone-pinout.txt
Created May 30, 2018 13:41
Pinout of the CMJCU TinyLily Clone of the lilypad
/*
_____ _____ __ _____ _____
| | |__| | | | |
| --| | | | | | --| | |
|_____|_|_|_|_____|_____|_____|
_____ _ __ _ _
|_ _|_|___ _ _| | |_| |_ _
| | | | | | | |__| | | | |
|_| |_|_|_|_ |_____|_|_|_ |
@thenoseman
thenoseman / fof-login-and-redirect-after.js
Last active September 14, 2017 08:59
Form-O-Fill : redirect after login
var rules = [{
"name": "Step 1 - do login",
"url": "https://someurl/login",
"fields": [{
"selector": "#loginname",
"value": "LOGINNAME"
}, {
"selector": "#password",
"value": "PASSWORD"
}, {
// Paste this into the URL of a created bookmark:
// Go to your leankit board and klick the link.
javascript:(function()%7Bvar%20body%20%3D%20document.querySelector(%22body%22)%3Bvar%20addStyle%20%3D%20function(css)%20%7Bvar%20style%20%3D%20document.createElement(%22style%22)%3Bstyle.innerText%20%3D%20css%3Bbody.appendChild(style)%3B%7D%3Bvar%20cookies%20%3D%20%5B%22https%3A%2F%2Fpicload.org%2Fimage%2Frprprwdi%2Fcookie.png%22%2C%22https%3A%2F%2Fpicload.org%2Fimage%2Frprpordi%2Fcookie2.png%22%5D%3Bvar%20chooser%20%3D%20document.createElement(%22div%22)%3Bchooser.className%20%3D%20%22cookie%22%3Bchooser.innerHTML%20%3D%20%22%3Cimg%20class%3D'cookie-use'%20src%3D'%22%20%2B%20cookies.join(%22'%2F%3E%3Cimg%20class%3D'cookie-use'%20src%3D'%22)%20%2B%20%22'%2F%3E%22%3Bbody.appendChild(chooser)%3Bcss%20%3D%20%22.cookie%20%7B%20padding%3A%205px%3B%20border%3A%201px%20solid%20%23000%3B%20position%3A%20absolute%3B%20bottom%3A%200%3B%20right%3A%200%3B%20width%3A%22%20%2B%20cookies.length%20*%2060%20%2B%20%22px%3B%20curs
@thenoseman
thenoseman / fof-example-multiple-findhtml.js
Created June 9, 2017 09:27
Form-O-Fill example : Using multiple context.findHtml() calls in before functions
var rules = [{
"name": "Fetching multiple thing from the content page with context.findHtml",
"url": "https://scotch.io/tutorials/javascript-promises-for-dummies",
"before": function(resolve, context) {
// Lets fetch two headlines from the page
// 1. Generate an array of Promises.
var promises = [
context.findHtml("#toc-understanding-promises"),
context.findHtml("#toc-creating-a-promise")
];
@thenoseman
thenoseman / fof-htmlfinder-get-to-api-change-page-example.js
Last active June 9, 2017 09:08
Form-O-Fill: Example of findHtml() -> sending data to an API -> display it
var rules = [{
// This rule demonstrates:
// 1. Fetching DOM elements from the page
// 2. Taking content from those DOM elements and send it to a API
// 3. Taking the response JSON from the API and change
// a form field based on that
//
// To test it import the rule, goto 'https://www.babycenter.com/top-baby-names-2017.htm'
// and press the Form-O-Fill extension button
// Now the search field at the top right should have a personalized Chuck Norris joke
@thenoseman
thenoseman / update_gamecontroller.sh
Created May 4, 2017 18:25
Updates the SDL2 gamecontrollerdb.txt for 8BitDo Zero Gamepads
#!/bin/bash
curl -o Contents/MacOS/gamecontrollerdb.txt "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt"
echo "What's is your gamepad GUID? (something like a0050000000000003232000000000000"
echo "Use http://www.generalarcade.com/gamepadtool/ for that."
read guid
grep "8Bitdo Zero GamePad" Contents/MacOS/gamecontrollerdb.txt | sed "s/05000000a00500003232000001000000/${guid}/" | sed "s/Linux/Mac OS X/" >> Contents/MacOS/gamecontrollerdb.txt
echo "Added '8Bitdo Zero GamePad' for Mac OS X to gamecontrollerdb.txt"