Skip to content

Instantly share code, notes, and snippets.

View RafhaanShah's full-sized avatar
💭
🚀

Rafhaan Shah RafhaanShah

💭
🚀
View GitHub Profile
@RafhaanShah
RafhaanShah / PRIVACY.md
Created April 21, 2024 17:12
Privacy Policy

This application collects and holds no personal information whatsoever.

@RafhaanShah
RafhaanShah / uberJar.gradle
Last active November 14, 2023 16:12
Gradle task to create an uber jar of all the runtime dependency classes of a package including Android libraries. Does NOT merge resources / XML / Manifest.
// create an uber JAR of all the runtime dependencies of a package
task uberJar(type: Jar) {
from {
// build flavour is needed for Android projects, otherwise it's just runtimeClasspath
configurations.releaseRuntimeClasspath.collect { original ->
// leave folders alone
if (original.isDirectory()) {
return original
}
@RafhaanShah
RafhaanShah / feeds.txt
Created December 24, 2022 19:27
Tech Blog RSS Feeds
https://www.uber.com/blog/rss/
https://engineering.fb.com/feed/
https://medium.com/feed/airbnb-engineering
https://github.blog/category/engineering/feed/
https://engineering.grab.com/feed.xml
https://tech.instacart.com/feed
https://engineering.linkedin.com/blog.rss.html
https://eng.lyft.com/feed/
https://netflixtechblog.com/feed/
https://medium.com/feed/@Pinterest_Engineering
@RafhaanShah
RafhaanShah / AndroidViewOnHoldListener.kt
Last active June 29, 2022 15:36
Android onHoldListener that calls a callback periodically while a view is being held, works for clicks as well.
fun View.setOnHoldListener(
firstClickDelayMillis: Long = 250L,
tickDelayMillis: Long = 100L,
onRelease: () -> Unit = {},
onTick: (Int) -> Unit
) {
val lifeCycleOwner = findViewTreeLifecycleOwner() ?: return
var job: Job? = null
// cancel this job if the lifeCycleOwner is ever paused
@RafhaanShah
RafhaanShah / ntopng-pi.Dockerfile
Last active April 17, 2022 12:00
ntopng on docker on raspberry pi
# https://packages.ntop.org/
# https://github.com/ntop/docker-ntop/commit/6600c0a49420aac78c724d93ef8c4ceab8878d52
FROM debian:bullseye
RUN apt-get update && \
apt-get -y -q install wget lsb-release gnupg libcap-dev net-tools && \
wget -q https://packages.ntop.org/RaspberryPI/apt-ntop_1.0.190416-469_all.deb && \
dpkg -i apt-ntop_1.0.190416-469_all.deb && \
apt-get clean all
@RafhaanShah
RafhaanShah / upnp-down.sh
Created April 17, 2022 11:32
Open ports dynamically using upnp
#!/bin/sh
upnpc -i -d 12345 UDP
@RafhaanShah
RafhaanShah / pi-bridge.txt
Last active April 17, 2022 14:51
Raspberry Pi Bridged Interfaces
# https://www.raspberrypi.com/documentation/computers/configuration.html#intro-to-bridged-wap
# https://www.maketecheasier.com/turn-raspberry-pi-into-wi-fi-bridge/
------------------------------
sudo nano /etc/systemd/network/bridge-br0.netdev
[NetDev]
Name=br0
Kind=bridge
@RafhaanShah
RafhaanShah / rclone.sh
Last active January 15, 2022 18:29
rclone cron job
#!/usr/bin/env bash
# https://rclone.org/
# crontab -e: 0 1 * * 0 /path/to/rclone.sh
set -eo pipefail
RCLONE="/home/raf/bin/rclone"
RCLONE_CONFIG="/home/raf/.config/rclone/rclone.conf"
@RafhaanShah
RafhaanShah / hammerspoon-audiowatcher.lua
Last active April 4, 2024 15:37
Hammpersoon Configs
function audioWatcher(eventType)
-- print ("Audio Event: " .. eventType)
target = "HD Pro Webcam C920"
if(eventType == "dIn ") then
cur = hs.audiodevice.defaultInputDevice():name()
if (cur ~= target) then
dev = hs.audiodevice.findInputByName(target)
if (dev ~= nil) then
print("Setting default input device to: " .. target)
dev:setDefaultInputDevice()
@RafhaanShah
RafhaanShah / hammerspoon-sleepwatcher.lua
Last active January 13, 2022 17:48
Hammerspoon Config for Wake/Sleep
function caffeinateWatcher(eventType)
if (eventType == hs.caffeinate.watcher.systemWillSleep or
eventType == hs.caffeinate.watcher.systemWillPowerOff) then
print ("Going to Sleep...")
-- Execute sleep script
-- hs.task.new("/Users/username/scripts/on_sleep.sh", nil):start()
-- hs.applescript('tell application "APP_NAME" to quit')
elseif (eventType == hs.caffeinate.watcher.systemDidWake) then
print ("Waking from Sleep...")
-- Execute wake script