Skip to content

Instantly share code, notes, and snippets.

View gammy's full-sized avatar

gammy gammy

  • Stockholm
View GitHub Profile
@gammy
gammy / upgrade_docuwiki
Created June 12, 2020 21:53
DokuWiki upgrade helper which takes conf and data directories into account.
#!/usr/bin/env bash
# Gammies grimey dokuwiki updater.
#
# This script is dumb, but not as dumb as the upgrade plugin.
# Use with caution: I may not have considered all possible scenarios.
# One thing this script does not check is adequate permission to create files
# and subdirectories. Just basic sanity is performed.
#
# Written mainly for my own needs.
@gammy
gammy / postgresql
Last active December 23, 2020 15:19
/etc/conf.d/postgresql from posgresql-openrc, adjusted to work on artix with the postgresql package.
# Comma-separated list of directories that contain a unix
# socket. Created and controlled by the related initscript. The
# directories created will be owned root:postgres with mode 1775.
#
# /run/postgresql is the default directory.
PG_SOCKET_DIRECTORIES="/run/postgresql"
# Which port and socket to bind PostgreSQL
PGPORT="5432"
@gammy
gammy / player.html
Last active November 22, 2017 18:23
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>asciinema local player</title>
<style>
.asciinema-player-wrapper {
position: relative;
text-align: center;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>asciinema local player</title>
<link rel="stylesheet" type="text/css" href="asciinema-player.css" />
<style>
body {
background: #3b3b3b;
@gammy
gammy / .vimrc
Created November 11, 2017 21:58
Gammies vimrc
" Gammies vimrc. This will work for both vim and gvim.
" Use Vim settings, rather then Vi settings
" This must be first, because it changes other options as a side effect.
set nocompatible
set nomodeline " Disable trying to read modelines in files
" (best to keep it off if you're unaware of it anyway)
" Automatically vsplit "foo.h" if "foo.c" is loaded and "foo.h" exists
function! OpenCFile()
#!/usr/bin/env bash
which adb || exit
if [ -z "$1" ]
then
echo "Usage: $(basename $0) com.app.package.name dbname" >&2
exit 1
fi
pkg=$1
#!/usr/bin/env python3
from __future__ import print_function
import sys
try:
input = sys.argv[1]
if not input:
print("No!", file=sys.stderr)
sys.exit(1)
#!/usr/bin/env python3
# Calculate occurrence of letters in two text files,
# and map out the closest relation
# (ie, perform frequency analysis and resolution)
from sys import argv, exit
from os.path import basename
import string
if len(argv) <= 2:
print("Usage: {} <file 1> <file b>".format(basename(argv[0])))
#!/usr/bin/perl
use warnings;
use strict;
my $song_file = '/export/home/gammy/.current_song';
my $ices_file = '/export/home/gammy/.ices_metadata';
my $ices_pidfile = '/export/home/gammy/.ices.pid';
sub read_file {
my $filename = shift;
#!/bin/sh
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# Amended by Kristian Gunstone for manjaro-openrc
# Released under the 2-clause BSD license.
export RC_SERVICE=/etc/init.d/$SVCNAME
export RC_SVCNAME=$SVCNAME
# If we have a service specific script, run this now
[ -x "${RC_SVCNAME}"-down.sh ] && "${RC_SVCNAME}"-down.sh