Skip to content

Instantly share code, notes, and snippets.

@linucksrox
linucksrox / docker-compose.yml
Created November 21, 2023 18:49
Unifi Network Application 8.0.7 with mongodb - docker-compose.yml
version: '3.7'
services:
unifi-db:
image: docker.io/mongo:latest
container_name: unifi-db
volumes:
- ./data:/data/db
- ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
@ansarizafar
ansarizafar / macos-app-icon.md
Created October 16, 2023 04:04 — forked from jamieweavis/macos-app-icon.md
How to create an .icns macOS app icon
@beader
beader / InfiniteTabView.swift
Last active July 8, 2024 08:59
Infinite Scrollable TabView using SwiftUI
//
// ContentView.swift
// InfinityTabView
//
// Created by beader on 2022/10/9.
//
import SwiftUI
struct ContentView: View {
@gullyn
gullyn / flappy.html
Last active May 4, 2024 15:35
Flappy bird in 205 bytes (improved!)
<body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c>
@haxrob
haxrob / covidsafe-cert-pin.md
Last active April 29, 2020 10:31
Modify certificate pinning for Australia Government Covidsafe Android Application
  1. Ensure your certificate for the MITM application is in PEM format. For example, Burp Suite generates the certificate in DER, so in this case, to convert from DER to PEM:
openssl x509 -inform der -in cacert.der -out cacert.pem

Note this certificate needs to also be installed on the Android device. Android expects DER format with the file extension .crt. If in doubt, consult google.com.

  1. Extract all three APKs. To avoid issues, -r is used.
apktool d -f -r au.gov.health.covidsafe.apk
apktool d -f -r config.xxhdpi.apk
@alexpaul
alexpaul / DataToURL.swift
Created April 15, 2020 01:11
Convert persisted Data to a temporary URL to configure an AVPlayer for video playback.
import AVFoundation
extension Data {
func convertToURL() -> URL {
let tempURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("video").appendingPathExtension("mp4")
do {
try self.write(to: tempURL, options: [.atomic])
} catch {
print()
}
@loilo
loilo / idb-backup-and-restore.md
Last active July 21, 2024 10:17
Back up and restore an IndexedDB database

Back up and restore an IndexedDB database

This gist is an ES module which provides functions to import and export data from an IndexedDB database as JSON. It's based on Justin Emery's indexeddb-export-import package, but applies some adjustments that reflect better on the current browser landscape (i.e. better developer ergonomics but no support for Internet Explorer).

Usage

For each of the provided functionalities, you need a connected IDBDatabase instance.

Export Data

import { idb } from 'some-database'
@RichardBronosky
RichardBronosky / touchid_sudo.sh
Last active June 21, 2024 12:00
Use TouchID for sudo on modern MacBook Pro machines
#!/bin/bash
# curl -sL https://gist.githubusercontent.com/RichardBronosky/31660eb4b0f0ba5e673b9bc3c9148a70/raw/touchid_sudo.sh | bash
# This script is ready to copy-paste in whole, or just the line above (without the leading #)
# Use TouchID for sudo on modern MacBook Pro machines
# This script adds a single line to the top of the PAM configuration for sudo
# See: https://apple.stackexchange.com/q/259093/41827 for more info.
touchid_sudo(){
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active July 20, 2024 18:21 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@ChrisLawther
ChrisLawther / CoordinateConversion.swift
Last active January 29, 2021 21:29
Code for converting British grid references into latitude and longitude
import CoreLocation
// A Swift reimplementation of the Objective-C code listed here :
// http://www.hannahfry.co.uk/blog/2014/12/26/more-on-converting-british-national-grid-to-latitude-and-longitude
extension CLLocation {
convenience init(easting E: Double, northing N: Double) {
// The Airy 180 semi-major and semi-minor axes used for OSGB36 (m)
let (a, b) = (6377563.396, 6356256.909)