Skip to content

Instantly share code, notes, and snippets.

View rayshan's full-sized avatar
🕵️‍♀️
Inspecting stocks...

Ray Shan rayshan

🕵️‍♀️
Inspecting stocks...
View GitHub Profile
@jstayco
jstayco / README.md
Last active September 12, 2023 19:29
Setup script for Kohya SS on macOS

MacOS (Apple Silicon)

In the terminal, run

git clone https://github.com/bmaltais/kohya_ss.git
cd kohya_ss
# Patch these files into top level/root project folder
# Then run the next command
bash ./macos.sh
@lancethomps
lancethomps / close_notifications_applescript.js
Last active April 8, 2024 07:43
AppleScript to close all notifications on macOS Big Sur, Monterey, and Ventura
function run(input, parameters) {
const appNames = [];
const skipAppNames = [];
const verbose = true;
const scriptName = "close_notifications_applescript";
const CLEAR_ALL_ACTION = "Clear All";
const CLEAR_ALL_ACTION_TOP = "Clear";
@kriskowal
kriskowal / uber-to-agoric.md
Last active May 10, 2022 22:51
Uber to Agoric

I have a bit of good news and bad news. Friday, April 3, was my last day at Uber. Monday, April 6, was my first day at Agoric.

I started at Uber 5½ years ago, on the dispatch system. I joined Tom Croucher’s team, which focused on common frameworks for marketplace systems, with Jake Verbaten, Russ Frank, and spiritually Matthew Esch. When I arrived, the scaffolding and frameworks were in place. I wrote a tool for verifying that JSON schema evolution remained backward-compatible, did some weird stuff to automatically mix the middleware stack, and wrote a thing to balance load across Node.js processes more fairly than the Linux kernel. I don’t believe any of that work made it to production, really, but for those six months, I learned how to operate global dispatch while I was on-call for 24 hours once a month and developed a bald spot.

I then got on board a new Distributed Systems Group under Matt Ranney’s guidance and many of the folks I’ve been working with to this day. Matt had designed a DHT based on the S

@mmazzarolo
mmazzarolo / watch.js
Created October 19, 2019 21:24
Develop a browser extension with live-reloading using Create React App without ejecting
#!/usr/bin/env node
// A script for developing a browser extension with live-reloading
// using Create React App (no need to eject).
// Run it instead of the "start" script of your app for a nice
// development environment.
// P.S.: Install webpack-extension-reloader before running it.
// Force a "development" environment in watch mode
process.env.BABEL_ENV = "development";
@mikkeldamm
mikkeldamm / connection.js
Created June 16, 2019 10:08
zeit now 2.0 mongodb connection
let cachedMongoClient = null;
let cachedMongoDb = null;
exports.connect = async () => {
if (cachedMongoDb && cachedMongoClient && cachedMongoClient.isConnected()) {
return cachedMongoDb;
}
cachedMongoClient = await MongoClient.connect('MONGO_CONNECTION', { useNewUrlParser: true });
@DivineDominion
DivineDominion / FolderContentMonitor.swift
Last active March 10, 2023 15:50
Wrapper for using C FSEvents with Swift 4
//
// Based on: https://blog.beecomedigital.com/2015/06/27/developing-a-filesystemwatcher-for-os-x-by-using-fsevents-with-swift-2/
//
import Foundation
public struct Event: CustomStringConvertible {
public let eventId: FSEventStreamEventId
public let eventPath: String
@steveharoz
steveharoz / .block
Last active April 10, 2024 07:11 — forked from mbostock/.block
d3-force testing ground
license: gpl-3.0
height: 1030
scrolling: yes
@Skorch
Skorch / s3-upload-processor.js
Last active January 18, 2021 09:13
AWS Lambda function which receives an S3 upload event, fetches the custom headers, parses the encoded payload, and handles the API call
var async = require('async');
var AWS = require('aws-sdk');
AWS.config.update({region:'us-east-1'});
var request = require('request');
var s3 = new AWS.S3({ apiVersion: '2006-03-01' });
var sns = new AWS.SNS();
var new_upload_arn = "arn:aws:sns:us-east-1:346805855669:vuedating_new_presenece";
//Lambda entry point
@asmagill
asmagill / ctrlDoublePress.lua
Created April 18, 2016 03:20
Capture double tap of Ctrl in Hammerspoon
local alert = require("hs.alert")
local timer = require("hs.timer")
local eventtap = require("hs.eventtap")
local events = eventtap.event.types
local module = {}
-- Save this in your Hammerspoon configuration directiorn (~/.hammerspoon/)
-- You either override timeFrame and action here or after including this file from another, e.g.
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent