Skip to content

Instantly share code, notes, and snippets.

@Kehet
Kehet / rebase-all-dependabot-pullrequests.sh
Last active December 29, 2023 14:24
Rebase all dependabot pullrequests
#!/bin/bash
gh pr list --author "app/dependabot" --json number \
| jq '.[].number' -r \
| while IFS=$'\t' read -r id; do gh pr comment $id --body "@dependabot rebase" ; done
# this would ask dependabot to merge all PRs
# | while IFS=$'\t' read -r id; do gh pr comment $id --body "@dependabot merge" ; done
#!/usr/bin/env sh
print_help() {
printf '%s\n' "This script generates mysql user and default database for this user"
printf 'Usage: %s <username> [<password>]\n' "$0"
printf '\t%s\n' "<username>: username and database name"
printf '\t%s\n' "<password>: password for user (default: generates random password using pwgen)"
}
die() {
<?php
namespace App\Console\Traits;
trait ArgumentOrAsk
{
public function argumentOrAsk($argumentName, $question = null, $default = null)
{
$argument = $this->argument($argumentName);
#!/bin/bash
if [ $# -eq 0 ] ; then
echo "USAGE: ${0} URL"
exit 1
fi
URL="$1"
if [ "$URL" = "${URL##https:\/\/}" ]; then
@Kehet
Kehet / fancytime.php
Last active March 28, 2021 11:53
laravel blade tag for formatting dates. place this into app/Providers/AppServiceProvider.php::boot
<?php
Blade::directive('fancytime', function ($time) {
return "<abbr title=\"<?php echo " . $time . "->format('d.m.Y H:i:s'); ?>\">" .
"<time datetime=\"<?php echo " . $time . "->toIso8601String(); ?>\">" .
"<?php echo " . $time . "->diffForHumans(); ?>" .
"</time>" .
"</abbr>";
});
@Kehet
Kehet / renew-relay-cert.sh
Created January 10, 2021 17:15
Extract certificate from Traefik and use it with Weechat
#!/bin/sh
ACME_PATH="/home/kehet/traefik/acme.json"
DOMAIN="secret.example.com"
WEECHAT_PATH="/home/kehet/weechat/weechat"
cat "${ACME_PATH}" | jq '.myresolver.Certificates[] | select( .domain.main == "${DOMAIN}" ) | .key' --raw-output | base64 -d > "${WEECHAT_PATH}/ssl/relay.pem"
cat "${ACME_PATH}" | jq '.myresolver.Certificates[] | select( .domain.main == "${DOMAIN}" ) | .certificate' --raw-output | base64 -d >> "${WEECHAT_PATH}/ssl/relay.pem"
echo "*/relay sslcertkey" > "${WEECHAT_PATH}/weechat_fifo"
@Kehet
Kehet / rofi-task.sh
Last active January 11, 2020 00:26
Rofi helper for taskwarrior (requires jq)
#!/usr/bin/env sh
ID=$(task export | jq -r 'sort_by( -.urgency )[] | [ (.id|tostring), .description ] | join(" ")' |
rofi -no-auto-select -i -dmenu -p "Task" |
cut -f 1)
[ -z "$ID" ] && echo "Cancelled." && exit
ACTION=$(printf "start\nstop\nedit\ndone" | rofi -no-auto-select -i -dmenu -p "Action")
[ -z "$ACTION" ] && echo "Cancelled." && exit
[706437,140212,275326,2708236,3571295,986174,3994116,279293,3769644,957836,180192,4823783,223212,312424,247820,79392,2303075,946301,2992993,3818702,652357,544858,185015,7208677,94564,126683,8514039,787504,2573453]
@Kehet
Kehet / mirc.ini
Created August 19, 2014 15:46
Solarized color scheme for mIRC
[colors]
# ...
n5=Solarized,0,15,10,9,8,8,8,15,11,11,15,6,9,9,7,6,15,15,11,11,15,0,6,0,7,7,15,0,0,15
[palettes]
# ...
n5=3552822,4342338,7695960,8616805,9868419,10592659,14018798,14939901,35253,1461195,3093212,8533715,12874092,13798182,10002730,39301
/poll "What's your favorite color?" "Blue" "Red" "Green" "Yellow"