Skip to content

Instantly share code, notes, and snippets.

View jeffrafter's full-sized avatar
You are amazing

Jeff Rafter (he/him) jeffrafter

You are amazing
View GitHub Profile
@jeffrafter
jeffrafter / sidekiq_queues_redis.md
Created March 25, 2024 22:35
Sidekiq / Redis / Queues

Check your queues

name_count = { }
queues = Sidekiq::Queue.all
queues.each do |queue|
  names = queue.map { |q| q.klass == 'ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper' ? q['wrapped'] : q.klass }
  foo = names.each do |n| 
    name_count[n] ||= 0
 name_count[n] += 1 
@jeffrafter
jeffrafter / useOnlineStatus.tsx
Last active August 18, 2023 12:57 — forked from patrickcze/useOnlineStatus.tsx
A basic hook to indicate if the user is online or offline
import React, { useState, useEffect, useContext } from "react"
const OnlineStatusContext = React.createContext(true)
type Props = {
children: React.ReactNode
}
export const OnlineStatusProvider: React.FC<Props> = ({ children }) => {
const [onlineStatus, setOnlineStatus] = useState<boolean>(typeof navigator !== "undefined" ? navigator.onLine : false)
@jeffrafter
jeffrafter / LICENSE.md
Last active November 30, 2021 05:23
Self Attribution License

Self attribution license

Self Attribution 1.0 United States

THE AUTHOR IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. THE AUTHOR PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. THE AUTHOR MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE.

License

THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS PUBLIC LICENSE ("LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.

@jeffrafter
jeffrafter / .macos
Last active December 26, 2022 15:56
Setup a new Macbook
#!/usr/bin/env bash
# Based on ~/.macos — https://mths.be/macos
set -e
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
@jeffrafter
jeffrafter / ManifestRequirementsOverride.txt
Created August 13, 2019 09:23
AndroidManifest.xml overrdies for Unreal 4.22 and OculusQuest
<!-- Requirements -->
<uses-sdk android:minSdkVersion="25" android:targetSdkVersion="25" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- Supported texture compression formats (cooked) -->
@jeffrafter
jeffrafter / README.md
Last active August 13, 2019 09:52
Install Android NDK r14b via homebew

When working with Unreal and trying to build for Android (like the Oculus Quest) it recommends having version r14b of the Android NDK tools installed. You could install this manually by downloading it or you can install it via homebrew.

Unfortunately the version available via homebrew is r19. The legacy formula has some problems. This formula uses the legacy formula and adds the more recent installation fixes.

brew cask install https://gist.githubusercontent.com/jeffrafter/93e4efc2119e5ecd84b4367c9f9c655a/raw/058499c99a697649d5116fce1c9dfa204bb25e54/android-ndk.rb
@jeffrafter
jeffrafter / README.md
Last active August 15, 2019 13:35
Unfollow everyone on modern twitter

Want to unfollow everyone on twitter?

Open a console

In Chrome, right-click and go to Inspect Element. Then click on the Console tab. Or hit: Shift+Cmd+j

Enter this:

How to use an OG Image:

  1. clone the repo
  2. add an image named og_image.png
  3. commit
  4. push
nj = require 'numjs'
u = new Utils()
u.loadImageToCanvas("./img1.jpg","canvasInput")
cannyEdgeDetection = () =>
src = cv.imread('canvasInput')
dst = new cv.Mat()
cv.cvtColor(src, src, cv.COLOR_RGB2GRAY, 0)
cv.Canny(src, dst, 50, 100, 3, false)

This is a creative-commons style open source license I invented. You can apply this license to software or other works and require that individuals that choose to use the software must claim that they invented it.

Self attribution license

Self Attribution 1.0 United States

Jeff Rafter IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. Jeff Rafter PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. Company MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE.

License