Skip to content

Instantly share code, notes, and snippets.

@naesean
naesean / jsonapi_oas.yml
Last active April 18, 2025 11:58
OpenAPI 3.0 schemas that comply with the JSON:API 1.0 specification
JSONAPIObject:
description: Includes the current JSON:API version for this specification as well as optional meta information
type: object
required:
- version
properties:
version:
type: string
default: '1.0'
example: '1.0'
@klingtnet
klingtnet / Viewsonic-VG2755-2k.md
Created January 14, 2020 15:14
Viewsonic VG2755-2k

Viewsonic VG2755-2k

A 27" WQHD business IPS display: specs.

Often customers report problems about humming or buzzing noises caused by badly designed power supplies when a device is connected and charged via USB-C to a display. One very bad example of this is the Lenovo ThinkVision P27h-10, but also devices from Dell and Philips seem to be noisy when USB-C charging is active. I owned one of the P27h-10 for a short time and the noise was unbearable so I returned the display to the seller. Except that the monitor was very good, sturdy built, crisp and very bright diplay. Nonetheless, I wanted to have a display where I can connect my X1 through a single cable.

The Viewsonic VG2755-2k works fine when connected via USB-C, it can provide up to 60W charging power (15W more than the Lenovo) and makes absolutely no noise.

@kylehowells
kylehowells / correct_dates.py
Created February 14, 2020 21:18
Automatically Corrects Insta360 Studio Snapshot Dates according to the filename.
import os
import re
import datetime
import piexif
filepath = os.path.abspath(".")
# Find files with `screenshot` in the name.
files = [f for f in os.listdir(filepath) if "screenshot" in f and f.endswith(".jpg")]
print(files)
@jesster2k10
jesster2k10 / README.md
Last active February 11, 2025 17:25
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:

@himalay
himalay / auto-dns.sh
Last active July 9, 2023 13:14
[Pi-hole auto DNS switch] The script automatically switches the DNS servers between Pi-hole and Cloudflare based on Pi-hole DNS Server status. #pihole #openwrt
#!/bin/sh
# The script automatically switches the DNS servers between Pi-hole and Cloudflare based on Pi-hole DNS Server status.
TARGET=192.168.0.7 # Pi-hole
FALLBACK_A=1.1.1.1 # Cloudflare
FALLBACK_B=1.0.0.1 # Cloudflare
function set_fallback_dns() {
echo $(date)