Skip to content

Instantly share code, notes, and snippets.

View c33s's full-sized avatar

Julian c33s

View GitHub Profile
@c33s
c33s / FinalClass.php
Created April 19, 2019 15:55 — forked from DragonBe/FinalClass.php
Testing final classes is tricky, but possible even though you cannot directly mock a "final" class
<?php
namespace FinalClass;
require_once __DIR__ . '/vendor/autoload.php';
use PHPUnit\Framework\TestCase;
final class Foo
{
protected $bar;
@c33s
c33s / README.md
Created February 28, 2019 17:56 — forked from magnetikonline/README.md
Bash string manipulation cheatsheet.

Bash string manipulation cheatsheet

Assignment
Assign value to variable if variable is not already set. Value will be returned.

Couple with : no-op if return value is to be discarded.
${variable="value"}
: ${variable="value"}
@c33s
c33s / FF57+RoomyBookmarksToolbar.md
Created December 11, 2018 20:49 — forked from sboettcher/FF57+RoomyBookmarksToolbar.md
Firefox Quantum Roomy Bookmarks Toolbar

In your Profile folder, add/edit the file chrome/userChrome.css with the following contents:

/* Recreates the basic functionality of the popular Roomy Bookmarks Toolbar add-on:
Hide bookmarks bar items label text, show on hover. */

.bookmark-item > .toolbarbutton-text {
  margin-top: -1px !important;
}
.bookmark-item {
@c33s
c33s / simpletask gtd.md
Created July 11, 2018 14:56 — forked from alehandrof/simpletask gtd.md
How to GTD with Simpletask

How to GTD with Simpletask

This is a guide to implementing Getting Things Done (GTD) using [Simpletask][] by [Mark Janssen][].

Simpletask uses the [todo.txt][] syntax, but has sufficient differences and quirks of its own to be worth describing in detail---at least, that's the story I'm going with. I actually began this guide as an exploration of my own trusted system. Personal workflows are by definition eccentric; I have included only what seems to me to be broadly useful.

This implementation of GTD covers the "standard" classifications: next actions by context, projects, somedays, agendas by person and meeting, etc. In a departure from strict GTD, each entry in these lists is also tagged with an area of focus, interest or responsibility. I find that the ability to slice the system by this extra dimension is worth the additional complexity at the processing and organizing stages. Limitations, issues and workarounds are discussed at the end.

Before we begin, some words of wisdom

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@c33s
c33s / rebase.md
Created March 29, 2018 20:57
Ultimate rebase-onto-master guide

Rebase "web-123-my-branch" onto master:

if you're the only person who is working on a branch...

$ git checkout web-123-my-branch # make sure you're on the right branch
$ git fetch # update remote refs
$ git rebase origin/master # perform the rebase onto the current state of master
  # for each conflict, edit file, resolve conflicts, git add -u <file>, git rebase --continue
$ git push -f origin web-123-my-branch # overwrite remote branch with newly rebase branch
@c33s
c33s / postgresql-drop-create.sh
Created May 21, 2017 16:39 — forked from cuberri/postgresql-drop-create.sh
Reminder script used to automate postgresql related stuff
#!/bin/bash
#-------------------------------------------------------------------------------
# RECREATE DATABASE FROM DDL AND DML SCRIPTS
#-------------------------------------------------------------------------------
BASEDIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SQLDIR="${BASEDIR}/sql"
PSQL_BIN="/usr/bin/psql"
PG_USER="<enter_pg_user_to_connect_with>"
@c33s
c33s / example usage:
Created January 21, 2017 01:37 — forked from jordansissel/example usage:
notify from a file change that is not managed by puppet
snack(~) % rm /tmp/flag
snack(~) % echo "Hello" > /tmp/original
snack(~) % sudo puppet apply unmanaged-notify.pp
notice: /Stage[main]//File[/tmp/flag]/ensure: defined content as '{md5}09f7e02f1290be211da707a266f153b3'
notice: /Stage[main]//Exec[hello world]: Triggered 'refresh' from 1 events
# Won't exec 'hello world' again because no change occured to /tmp/original:
snack(~) % sudo puppet apply unmanaged-notify.pp
# Now change /tmp/original:
@c33s
c33s / backend.conf
Created November 30, 2016 00:35 — forked from caquino/backend.conf
server {
listen 80;
server_name backend;
root /usr/share/nginx/www;
index index.html index.html;
location / {
header_filter_by_lua '
@c33s
c33s / logstash_postfix.conf
Created September 14, 2016 18:28 — forked from danslimmon/logstash_postfix.conf
My logstash config for postfix logs
filter {
# Capture all the generic syslog stuff and populate @timestamp
if [type] == "postfix" {
grok {
match => [ "message", "%{SYSLOGBASE} %{GREEDYDATA:_syslog_payload}" ]
singles => true
}
# Postfix pads single-digit numbers with spaces (WHYYYYY)
mutate { gsub => [ "timestamp", " ", " 0" ] }
date { match => [ "timestamp", "MMM dd HH:mm:ss"] }