Skip to content

Instantly share code, notes, and snippets.

View c33s's full-sized avatar

Julian c33s

View GitHub Profile
/*Transparent pattern placed over an image, like we see on the bootstrap homepage: http://twitter.github.com/bootstrap/index.html*/
div {
width: 200px;
height: 200px;
display: block;
position: relative;
background: url(images/background-image.png);
}
@c33s
c33s / osx-10-10-virtualbox.md
Created July 9, 2016 03:01 — forked from frdmn/osx-10-10-virtualbox.md
Install OS X 10.10 Yosemite in VirtualBox
@c33s
c33s / uniqueid.pp
Created September 8, 2016 00:48 — forked from lavoiesl/uniqueid.pp
Puppet: Generate a unique integer id base on the hostname
#
# Generate a unique integer id base on the hostname
# It works by stripping $domain from the $::fqdn,
# removing all characters except alphanumeric and converting to base 10
# $domain is provided if you have complex domains like *.hosting.example.com
#
class uniqueid (
$domain = $::domain,
) {
$node_id = inline_template("<%= '$::fqdn'.gsub('$domain','').gsub(/[^a-z0-9]/i,'').to_i(36) %>")
@c33s
c33s / default.vcl
Created September 8, 2016 16:05 — forked from pborreli/default.vcl
If you are using Varnish and ESI with a Symfony application and need to profile not only the master request but with ESI requests included, don't announce your ESI support, Symfony will fallback to internal sub requests.
sub vcl_recv {
if (req.http.X-Blackfire-Query && client.ip ~ profile) {
//set req.backend_hint = backend1; // if you want to disable loadbalancer to profile (aka only 1 backend needs blackfire extension
return (pass);
} else {
// Add a Surrogate-Capability header to announce ESI support.
set req.http.Surrogate-Capability = "abc=ESI/1.0";
}
}
@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"] }
@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 / 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 / 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 / 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

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