Skip to content

Instantly share code, notes, and snippets.

@twnaing
twnaing / Caddyfile
Created July 3, 2020 08:37
Caddyfile v2 for Ruby on Rails application
http://{$CADDY_HOST}:{$CADDY_PORT} {
root * ./public
@notStatic {
not {
file {
try_files {path}
}
}
}
@nickferrando
nickferrando / imagemagick-ubuntu.txt
Last active April 25, 2024 04:05
Install ImageMagick with JPG, PNG and TIFF Delegates - Ubuntu (20.04)
#These are the steps required in order to Install ImageMagick with JPG, PNG and TIFF delegates.
sudo apt-get update
#Install Build-Essential in order to configure and make the final Install
sudo apt-get install build-essential
#libjpg62-dev required in order to work with basic JPG files
@jesster2k10
jesster2k10 / README.md
Last active April 25, 2024 00:54
JWT Auth + Refresh Tokens in Rails

JWT Auth + Refresh Tokens in Rails

This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.

I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)

Before trying it out DIY, I considered using:

@jessarcher
jessarcher / dslr-webcam.md
Last active March 10, 2024 17:25
Using my Canon 70D DSLR camera as a web cam on Linux

You'll need:

  1. Video 4 Linux loopback device kernel module (v4l2loopback) - Source: https://github.com/umlaeute/v4l2loopback (You might find builds in your distro's repos - I'm using Fedora so had to build it myself using https://github.com/danielkza/v4l2loopback-fedora/)
  2. gPhoto2 - this is what allows you to access your cameras live feed over USB - this was available in Fedora's repos.
  3. GStreamer or ffmpeg - this is what lets you stream the output from gPhoto2 into the loopback device.

It's been a little while since I set it all up so I can't remember all of the installation details, which will probably be different for your distro anyway unless you're using Fedora. Apologies if I have forgotten something as wel.

Running the stream

# This is a blocklist to block samsung smart tv's sending meta data at home.
# Please help to collect domains!
# It could be that the TV does not receive any more updates or other services no longer work. Please report such an incident.
# https://gist.github.com/Perflyst/315f86393712a0c2107ee8eb58c6acee
0.0.0.0 device-metrics-us.amazon.com
0.0.0.0 samsungacr.com
0.0.0.0 samsungcloudsolution.com
0.0.0.0 samsungcloudsolution.net
0.0.0.0 pavv.co.kr
@mikepruett3
mikepruett3 / shell-setup.ps1
Last active April 16, 2024 22:19
Packages to install via scoop, winget, choco, and other tools...
<#
.SYNOPSIS
Script to Initialize my custom powershell setup.
.DESCRIPTION
Script uses scoop
.NOTES
**NOTE** Will configure the Execution Policy for the "CurrentUser" to Unrestricted.
Author: Mike Pruett
Date: October 18th, 2018
@twnaing
twnaing / cloudSettings
Last active August 31, 2021 09:12
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-08-31T09:12:11.160Z","extensionVersion":"v3.4.3"}
@chetan
chetan / db.rake
Last active July 12, 2022 19:18 — forked from e12e/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
# Original source: https://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90
# Merged with: https://gist.github.com/kofronpi/37130f5ed670465b1fe2d170f754f8c6
#
# This is the code from the comment:
# https://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90#gistcomment-2275324
# Made into a fork/separate gist for easier download, with redundant shell-script removed.
#
#
# Usage:
@lifepillar
lifepillar / 24-bit-color.sh
Created November 20, 2017 11:48
Test 24 bit colors in terminals
#!/bin/bash
#
# This file echoes a bunch of 24-bit color codes
# to the terminal to demonstrate its functionality.
# The foreground escape sequence is ^[38;2;<r>;<g>;<b>m
# The background escape sequence is ^[48;2;<r>;<g>;<b>m
# <r> <g> <b> range from 0 to 255 inclusive.
# The escape sequence ^[0m returns output to default
setBackgroundColor()