Skip to content

Instantly share code, notes, and snippets.

@huytd
huytd / wordle.md
Last active May 16, 2024 20:39
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@m-radzikowski
m-radzikowski / script-template.sh
Last active June 25, 2024 12:02
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@ctron
ctron / tekton-cleanup.yaml
Last active May 10, 2024 12:18
Cleaning up Tekton pipeline runs
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: cleaner
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: cleaner
@jaumef
jaumef / status.sh
Last active May 17, 2021 07:37
Check status of repo and reformat + check typing
#!/bin/bash
# Link/copy this file to your bin folder so you can run this easily
#
# ln -s $PWD/status.sh ~/.local/bin/status
pyfiles=$(git status -s | grep -vE '^ ?[DR] ' | awk {'print $2'} | grep '.py')
if [[ $pyfiles ]]
then
@abbaspour
abbaspour / nginx.conf
Last active June 14, 2024 13:37
Guide how to enable JWT validation on open source nginx server using ngx-http-auth-jwt-module
daemon off;
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
@williamsiuhang
williamsiuhang / rn-gyroscope-parallax.js
Created July 9, 2020 20:41
React Native Image 3D Parallax using mobile gyroscope (Expo's DeviceMotion)
import React from 'react';
import { View, Animated, Easing } from 'react-native';
import { DeviceMotion } from 'expo-sensors';
class AnimatedAnalyticsImage extends React.Component {
state = {
motionX: 0,
motionY: 0,
motionZ: 0
@ryanburnette
ryanburnette / Caddyfile
Last active July 2, 2024 15:10
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 February 10, 2022 01:38
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 April 30, 2024 06:02
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.