Skip to content

Instantly share code, notes, and snippets.

@staltz
staltz / how.md
Last active May 6, 2024 03:12
How to debug Mocha tests written in Babel, running only in Node.js

Run this in one shell

./node_modules/.bin/mocha --debug-brk --compilers js:babel-register test/node

Then this in another shell

node-inspector

Then open the browser

@staltz
staltz / helper.js
Created June 6, 2016 10:56
How to use Stanga (https://github.com/milankinen/stanga) as a wrapper, not as a driver
// Generic helper function that takes a main() (the top-level component)
// and wraps it with Stanga logic
function wrapWithStanga(main, initialState) {
return function (sources) {
const modProxy$ = new Subject();
const modelSource = Model(initialState)(modProxy$);
sources.model = modelSource;
const sinks = main(sources);
sinks.model.subscribe(modProxy$);
@staltz
staltz / main.js
Created June 22, 2016 15:06
A-Frame + Cycle.js demo
import xs from 'xstream';
import Cycle from '@cycle/xstream-run';
import {h, makeDOMDriver} from '@cycle/dom';
require('aframe');
function main(sources) {
let vdom$ = xs.periodic(16).startWith(0).map(i =>
h('a-scene', [
h('a-sphere', {
attrs: {
@staltz
staltz / streamio.js
Created October 3, 2016 13:22
Playful Haskell Stream I/O with ES6 Generators
function *main() {
const confirmRequest = {
type: 'confirm',
value: 'Are you sure?',
};
const confirmResponse = yield confirmRequest;
if (confirmResponse === true) {
const consoleRequest = {
type: 'console',
#include <metal_stdlib>
using namespace metal;
namespace JuliaSet {
/// HSV -> RGB
half3 hsv2rgb(half3 c) {
half3 rgb = clamp(abs(fmod(c.x * 6.0 + half3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0);
return c.z * mix(half3(1.0), rgb, c.y);
}
@staltz
staltz / adnetworks.txt
Created November 20, 2016 10:34
Ban these domains of ad networks
101com.com, 101order.com, 123found.com, 180hits.de, 180searchassistant.com, 1x1rank.com, 207.net, 247media.com, 24log.com, 24log.de, 24pm-affiliation.com, 2mdn.net, 2o7.net, 360yield.com, 4affiliate.net, 4d5.net, 50websads.com, 518ad.com, 51yes.com, 600z.com, 777partner.com, 77tracking.com, 7bpeople.com, 7search.com, 99count.com, a-ads.com, a-counter.kiev.ua, a.0day.kiev.ua, a.aproductmsg.com, a.collective-media.net, a.consumer.net, a.mktw.net, a.sakh.com, a.ucoz.net, a.ucoz.ru, a.xanga.com, a32.g.a.yimg.com, aaddzz.com, abacho.net, abc-ads.com, absoluteclickscom.com, abz.com, ac.rnm.ca, accounts.pkr.com.invalid, acsseo.com, actionsplash.com, actualdeals.com, acuityads.com, ad-balancer.at, ad-balancer.net, ad-center.com, ad-images.suntimes.com, ad-pay.de, ad-rotator.com, ad-server.gulasidorna.se, ad-serverparc.nl, ad-souk.com, ad-space.net, ad-tech.com, ad-up.com, ad.100.tbn.ru, ad.71i.de, ad.980x.com, ad.a8.net, ad.abcnews.com, ad.abctv.com, ad.about.com, ad.aboutit.de, ad.aboutwebservices.com, ad.abum.com,
@staltz
staltz / example.js
Created March 18, 2019 20:59
Build your own RxJS
function createObservable(subscribe) {
return {
subscribe,
pipe: function(operator) {
return operator(this);
},
};
}
const numberObservable = createObservable(function(observer) {
@FrankSpierings
FrankSpierings / frida.py
Created March 24, 2019 13:05
Ghidra Plugin - Generate Frida Hooks - Requires Oneshot Decompiler Parameter ID
#TODO write a description for this script
#@author
#@category _NEW_
#@keybinding
#@menupath
#@toolbar
#TODO Add User Code Here
def getFunctions():
@padeoe
padeoe / README_hfd.md
Last active May 6, 2024 03:09
CLI-Tool for download Huggingface models and datasets with aria2/wget+git

🤗Huggingface Model Downloader

Considering the lack of multi-threaded download support in the official huggingface-cli, and the inadequate error handling in hf_transfer, this command-line tool smartly utilizes wget or aria2 for LFS files and git clone for the rest.

Features

  • ⏯️ Resume from breakpoint: You can re-run it or Ctrl+C anytime.
  • 🚀 Multi-threaded Download: Utilize multiple threads to speed up the download process.
  • 🚫 File Exclusion: Use --exclude or --include to skip or specify files, save time for models with duplicate formats (e.g., *.bin or *.safetensors).
  • 🔐 Auth Support: For gated models that require Huggingface login, use --hf_username and --hf_token to authenticate.
  • 🪞 Mirror Site Support: Set up with HF_ENDPOINT environment variable.
@mortenson
mortenson / sams_portland_stuff.md
Last active May 6, 2024 03:08
Sam's fun things to do in Portland

Portland recommendations by Sam

Sorted by location-ish. I tried to reduce the list to places I think are good for visitors vs. my absolute favorites, but I put a section at the bottom for places that may not be for everyone.

Breakfast / Brunch

Toki Restaurant (Downtown)

580 SW 12th Ave

My order: Grilled mackerel breakfast with a bloody mary. Their Dalgona coffee is quite good too.