Skip to content

Instantly share code, notes, and snippets.

View ozh's full-sized avatar
🍷
More wine, please.

྅༻ Ǭɀħ ༄༆ཉ ozh

🍷
More wine, please.
View GitHub Profile
@Ozhcar
Ozhcar / dir_file_renamer.py
Last active April 5, 2021 18:03
For my dad
from PIL import Image, ImageFont, ImageDraw
import glob
import os
import re
import time
""""""
dir_to_watch_name = './to_watch'
watch_every = 10
@m-radzikowski
m-radzikowski / script-template.sh
Last active April 25, 2024 18:43
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...]
@vielhuber
vielhuber / App.php
Last active June 14, 2021 06:50
properly test header redirect in phpunit #php
<?php
// src/App.php
namespace Example;
class App
{
public function redirect($url)
{
header('Location: ' . $url, true, 302);
die();
@hashworks
hashworks / kutt.sh
Created November 6, 2020 17:25
BASH function for kutt.it URL shortener services
KUTT_HOST="https://kutt.it"
KUTT_API_KEY="API_KEY"
kutt() {
if [[ "$1" == "delete" ]] && [[ -n "$2" ]]; then
curl -s -H "X-API-KEY: $KUTT_API_KEY" \
-X DELETE \
"$KUTT_HOST/api/v2/links/$2" | jq
elif [[ -z "$1" ]]; then
curl -s -H "X-API-KEY: $KUTT_API_KEY" \
"$KUTT_HOST/api/v2/links" | jq
@fworks
fworks / install-zsh-windows-git-bash.md
Last active April 19, 2024 19:52
Zsh / Oh-my-zsh on Windows Git Bash
@msegu
msegu / toURI.php
Last active May 26, 2020 16:34
URL/URI full encoding
<?php
/*
Need to encode given (finished) path and query?, for example
'http://example.org:port/path1/path2/data?key1=value1&argument#fragment' (1)
or 'scheme://user:password@example.com:port/path1/path2/data?key1=value1&key2=value2#fragment' (2)
e.g. this (2) should be encoded:
'scheme://'.rawurlencode('user').':'.rawurlencode('password').'@example.com:port/'
.rawurlencode('path1').'/'.rawurlencode('path2').'/'.rawurlencode('data')
.'?'.htmlentities(urlencode('key1').'='.urlencode('value1').'&'.urlencode('key2').'='.urlencode('value2'))
@timabell
timabell / assoc.ps1
Last active December 6, 2022 15:22
set windows file associations
# https://gist.github.com/timabell/bc90e0808ec1cda173ca09225a16e194
# MIT license
$exts=@(
"csv",
"csproj",
"json",
"log",
"md",
"patch",
"sql",
@tivnet
tivnet / apigen-hooks.php
Created November 2, 2016 17:58
Generate list of hooks (for WPGlobus)
<?php
/**
* File: apigen-hooks.php
*
* NOTE: this code is used internally in WPGlobus project.
* It's a W.I.P. - please use it, but do not forget to adapt for your project.
*
* @package WPGlobus\APIGen
* @author Gregory Karpinsky (@tivnet)
*/
@kylefrost
kylefrost / HOWTO.md
Last active July 31, 2021 19:24
How-To: Tweet All Commit Messages

Creating the post-commit file

Note: If you want to use your personal Twitter account to post commits, go to Step 2

  1. Create a new Twitter account for your commit messages. Example
  2. Go to http://dev.twitter.com and Sign In with your Twitter account you are posting commit messages to.
  3. Hover over your username in the top-right corner after signing in and select "My Applications"
  4. Create a new application
  5. The name, description, and site can all be whatever you want, but leave Callback URL empty
  6. Under "Application Settings" click "modify app permissions" next to "Access level"
@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.