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() {
#!/bin/bash
if [ $# -eq 0 ] ; then
echo "USAGE: ${0} URL"
exit 1
fi
URL="$1"
if [ "$URL" = "${URL##https:\/\/}" ]; then
<?php
namespace App\Console\Traits;
trait ArgumentOrAsk
{
public function argumentOrAsk($argumentName, $question = null, $default = null)
{
$argument = $this->argument($argumentName);
@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
/poll "What's your favorite color?" "Blue" "Red" "Green" "Yellow"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#define NUMBER '0'
#define MAXOP 100
#define MAXVAL 100
#define BUFSIZE 100
int sp = 0;
[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 / svn-remover.sh
Created November 14, 2017 09:10
remove svn folders from project
find . -type d -name '.svn' -print -exec rm -rf {} \;