Skip to content

Instantly share code, notes, and snippets.

View jnbdz's full-sized avatar
👨‍💻
None stop

JN Σ jnbdz

👨‍💻
None stop
View GitHub Profile
@jnbdz
jnbdz / pre-push
Created September 14, 2024 22:38
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Function to output error messages
error() {
echo "Error: $1" >&2
exit 1
}
Some cookies are misusing the recommended “SameSite“ attribute 2
Cookie “q_auth_d97c331f-595d-4592-8b1a-6166bbeea031” does not have a proper “SameSite” attribute value. Soon, cookies without the “SameSite” attribute or with an invalid value will be treated as “Lax”. This means that the cookie will no longer be sent in third-party contexts. If your application depends on this cookie being available in such contexts, please add the “SameSite=None“ attribute to it. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite localhost:8442
Cookie “q_session_chunk_2” does not have a proper “SameSite” attribute value. Soon, cookies without the “SameSite” attribute or with an invalid value will be treated as “Lax”. This means that the cookie will no longer be sent in third-party contexts. If your application depends on this cookie being available in such contexts, please add the “SameSite=None“ attribute to it. To know more about the “SameSite“ attribut
// Source: https://miloserdov.org/?p=2667
sudo swapoff /swapfile
sudo swapon --priority 100 /swapfile
#!/usr/bin/env bash
# Check for dependencies
if ! command -v fzf &> /dev/null; then
echo "fzf is required but it's not installed. Exiting."
exit 1
fi
locale="en_US"
locale=${locale%%_*} # Extract just the first part (e.g., "en" from "en_US")
name: Convert drawio to Image
on:
push:
paths:
- '**/*.drawio'
jobs:
convert:
runs-on: ubuntu-latest
#!/usr/bin/env bash
outputFile="config/manab_en.csv"
# Convert CSV to a simpler format and use fzf for searching
awk -F',' '{gsub(/"/, "", $1); gsub(/"/, "", $2); printf "%-15s %s\n", $1, $2}' "$outputFile" | fzf --ansi --preview-window=hidden:wrap
awk '{if (!match($0, /^[[:print:]\t\n\r]+$/)) print NR, $0}' ~/.bash_history
find bookmarks/ -type f -name "bookmarks.csv" -print0 | while IFS= read -r -d $'\0' file; do tail -n +2 "$file" | csvquote | awk -F "," '{ gsub(/^[ \t]+|[ \t]+$/, "", $2); print $2 }' | csvquote -u | sed 's/"//g'; done | grep -v '^\s*$' | fzf | xargs -r firefox
#!/bin/bash
# Your system locale, for example "en_US". You might dynamically get this with `echo $LANG` or `locale`.
locale="en_US"
locale=${locale%%_*} # Extract just the first part (e.g., "en" from "en_US")
# Find .desktop files that can handle HTTP/HTTPS and are not mimeinfo.cache
desktop_files=$(grep -rE "x-scheme-handler/(http|https)" /usr/share/applications/ ~/.local/share/applications/ | grep -E ".desktop:" | awk -F ":" '{ print $1 }' | sort -u)
# Create an associative array to hold appName => Exec mapping