Skip to content

Instantly share code, notes, and snippets.

@ryanburnette
ryanburnette / Caddyfile
Last active February 16, 2025 00:07
Caddy v2.1+ CORS whitelist
(cors) {
@cors_preflight{args.0} method OPTIONS
@cors{args.0} header Origin {args.0}
handle @cors_preflight{args.0} {
header {
Access-Control-Allow-Origin "{args.0}"
Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS"
Access-Control-Allow-Headers *
Access-Control-Max-Age "3600"
@blaurt
blaurt / latLonToOffsets.js
Last active March 28, 2022 17:30
transformAndPoint.js
/**
* @param {number} latitude in degrees
* @param {number} longitude in degrees
* @param {number} mapWidth in pixels
* @param {number} mapHeight in pixels
*/
function latLonToOffsets(latitude, longitude, mapWidth, mapHeight) {
const FE = 180; // false easting
const radius = mapWidth / (2 * Math.PI);
@kevineinarsson
kevineinarsson / 91-pulseaudio-custom.rules
Last active January 31, 2025 14:57
MBP 16,1 System configuration files for the T2 audio driver (https://github.com/MCMrARM/mbp2018-bridge-drv/)
SUBSYSTEM!="sound", GOTO="pulseaudio_end"
ACTION!="change", GOTO="pulseaudio_end"
KERNEL!="card*", GOTO="pulseaudio_end"
SUBSYSTEMS=="pci", ATTRS{vendor}=="0x106b", ATTRS{device}=="0x1803", ENV{PULSE_PROFILE_SET}="apple-t2.conf"
LABEL="pulseaudio_end"
@nstarke
nstarke / netgear-private-key-disclosure.md
Last active January 23, 2025 21:42
Netgear TLS Private Key Disclosure through Device Firmware Images

Netgear Signed TLS Cert Private Key Disclosure

Overview

There are at least two valid, signed TLS certificates that are bundled with publicly available Netgear device firmware.

These certificates are trusted by browsers on all platforms, but will surely be added to revocation lists shortly.

The firmware images that contained these certificates along with their private keys were publicly available for download through Netgear's support website, without authentication; thus anyone in the world could have retrieved these keys.

@3m3x
3m3x / README.md
Last active February 12, 2025 04:44
Update proxy list in proxychains config

What?

A thin Python script to update the proxy list in proxychains.conf with output from proxybroker.

Why?

Well, the proxies pulled down by proxybroker are often stale or useless for our purposes.

And updating proxychains.conf with new proxies is a pain in the ass.

Ok

Just run it in the background and never be without usable proxies again (⌐■_■)

@denis-ryzhkov
denis-ryzhkov / patch_graphene_django_JSONField_converter.py
Last active December 25, 2024 06:11
Ask `graphene_django` to convert `JSONField` to `GenericScalar` (JSON as is) instead of default `JSONString`
from django.contrib.postgres.fields import JSONField
from graphene.types.generic import GenericScalar
from graphene.utils.str_converters import to_camel_case, to_snake_case
from graphene_django.converter import convert_django_field
def patch_graphene_django_JSONField_converter(auto_camel_case=True):
"""
Ask `graphene_django` to convert `JSONField` to `GenericScalar` (JSON as is) instead of default `JSONString`
@kuboris
kuboris / mapexport.py
Created April 13, 2018 14:42
Create PDF map with custom projection using Mapnik and TileMill
#used in jupyter notebook with Python 2
!apt-get install python-cairocffi
!pip install mapnik
import mapnik
import cairocffi as cairo
map = mapnik.Map (1750 ,1185)
mapnik.load_map ( map ,'wallmap.xml')
@seanhandley
seanhandley / docker-compose.yml
Last active January 23, 2025 09:49
How To Set Up Docker For Mac (Mojave) with Native NFS
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
@ecarreras
ecarreras / test_show_qt_window.py
Created March 27, 2018 21:58
test_show_qt_window.py
from PyQt4.QtGui import QApplication, QMainWindow, QDialog, QHBoxLayout
from PyQt4.QtCore import SIGNAL
from Koo.Rpc import Rpc
from Koo.Common import Api
from Koo.Common import Localization
Localization.initializeTranslations()
from Koo.Dialogs import WindowService
x = Rpc.session.login('http://admin:admin@localhost:8069', 'test_1522167327')
@jalcantarab
jalcantarab / _jsonPuller.md
Last active March 11, 2025 23:14 — forked from crstamps2/jsonPuller
A Google apps script to pull json from a spreadsheet

JSON Puller - Google Apps Script

Transforms the data of a given Spreadsheet Sheet to JSON.

  • The frozen rows are taken as keys for the JSON.
  • The data taken for the values is only that after the frozen rows

Set up:

exportJSON(Spreadsheet) - transforms the data in the given sheet to JSON.