This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if ! command -p sudo -n -v > /dev/null 2>&1; then | |
echo "Execute this script as admin by using sudo writing:" | |
echo " sudo !!" | |
echo | |
fi | |
# Update | |
apt update -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You need to change last param of the resource url for your stop number | |
# You need to change "A" for whatever your line it is | |
# You can view all default params information stop here: | |
#. https://www.tua.es/es/lineas-y-horarios/paradas/uria-centro-1218.html?idLinea=6#paradasIda | |
# homeassistant: | |
# packages: | |
# rest: !include tua.yaml | |
input_text: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# GIT_USERNAME="" | |
GIT_PUBLIC_KEYS_AUTHORIZED_KEYS_FILE="${GIT_PUBLIC_KEYS_AUTHORIZED_KEYS_FILE:-${HOME}/.ssh/authorized_keys}" | |
GIT_PUBLIC_KEYS_START="## Start of git public keys" | |
GIT_PUBLIC_KEYS_STOP="## End of git public keys" | |
tmp_file=$(mktemp) | |
clean() { | |
rm -f "$tmp_file" "${GIT_PUBLIC_KEYS_AUTHORIZED_KEYS_FILE}.gitkeys" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(typeof Object.groupBy === typeof undefined) { | |
Object.groupBy = (arr, callback) => { | |
return arr.reduce((acc = {}, ...args) => { | |
const key = callback(...args); | |
acc[key] ??= [] | |
acc[key].push(args[0]); | |
return acc; | |
}, {}) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# To use this script see comments | |
write::out() { | |
echo "$@" | |
} | |
write::log() { | |
[[ ! -z "$DEBUG" ]] && write::out "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Delete all duplicate rules | |
/sbin/service iptables save | |
/sbin/iptables-save | awk '/^COMMIT$/ { delete x; }; !x[$0]++' > /tmp/iptables.conf | |
/sbin/iptables -F | |
/sbin/iptables-restore < /tmp/iptables.conf | |
/sbin/service iptables save | |
/sbin/service iptables restart | |
if [ -f /tmp/iptables.conf ] ; then /bin/rm -f /tmp/iptables.conf ; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// bun --hot sse.ts | |
import { randomUUID } from "node:crypto"; | |
import { EventEmitter } from "node:events"; | |
const sseEvents = new EventEmitter(); | |
export const sse = (data) => { | |
sseEvents.emit( | |
"sse", | |
`id: ${randomUUID()}\ndata: ${JSON.stringify(data)}\n\n` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#shellcheck disable=SC2016 | |
set -euo pipefail | |
if [[ -z "${DOTLY_PATH:-}" ]] || ! output::empty_line > /dev/null 2>&1; then | |
red='\033[0;31m' | |
green='\033[0;32m' | |
bold_blue='\033[1m\033[34m' | |
normal='\033[0m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Source: https://twitter.com/midudev/status/1652957687015940097 */ | |
background-color: Canvas; | |
color: CanvasText; | |
color-scheme: light dark; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isBun() { | |
return Boolean(globalThis.Bun); | |
} | |
function isDeno() { | |
return Boolean(globalThis.Deno); | |
} | |
function isNode() { | |
return Boolean(globalThis.process?.versions?.node); |
NewerOlder