Skip to content

Instantly share code, notes, and snippets.

@fullpipe
fullpipe / Caddyfile
Created February 5, 2023 22:29
Angular app with Caddy server and Docker for k8s
{
auto_https off
http_port 8080
admin off
}
:8080 {
root * /app
encode zstd gzip
file_server
@fullpipe
fullpipe / !prettier set up.md
Last active October 17, 2020 18:50
Prettier set up for ionic framework

Install prettier

npm i -D tslint-config-prettier tslint-plugin-prettier prettier

Copy configs

curl https://gist.githubusercontent.com/fullpipe/79df8bd11cecd9ee192def166947b9e8/raw/2abd93d5ddba7de400667840269a1cdd601bda21/tslint.json > tslint.json
@fullpipe
fullpipe / Combinator.php
Created June 2, 2019 08:32
Iterator over combinations of array elements.
<?php
class Combinator implements \Iterator
{
/**
* @var array
*/
private $data;
/**
@fullpipe
fullpipe / phpstorm-cs-fixer.md
Last active July 5, 2018 13:12 — forked from nienkedekker/phpstorm-cs-fixer.md
Set up PHP-CS-Fixer in PHPStorm

Use PHP-CS-Fixer in PHPStorm

  • Install PHP-CS-Fixer on your local machine according to these instructions: https://github.com/FriendsOfPHP/PHP-CS-Fixer
  • Open PHPStorm, Preferences > Tools > External Tools and enter these values: img
  • Program, edit to match your path where PHP-CS-Fixer lives: /.composer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer
  • Parameters: --config=$ProjectFileDir$/.php_cs fix $FileDir$/$FileName$.
  • Working directory: $ProjectFileDir$

Click OK and Apply. Now we'll set up a shortcut.

  • Go to Preferences > Keymap and search for "PHP Fixer" (or whatever name you gave it). Add whatever shortcut you like, I'm using ctrl + cmd + ]:
@fullpipe
fullpipe / calc.sh
Last active January 30, 2018 10:36
Calculate size of a source code base
#!/bin/bash
#
# Copyright 2016-2017 by Chris Niswander.
#
# Example script calculates the total size (in bytes) of the files
# having (a) specified type(s)/extension(s),
# in the directory tree specified by command line argument.
#
# See also: http://bitboost.com/python-obfuscator/articles_and_resources/how-to-calculate-the-total-size-length-of-your-code-or-codebase-in-bytes-fixing-inaccuracies-problems-in-du--an-easy-way
#
@fullpipe
fullpipe / icu-install.sh
Last active January 19, 2018 14:17 — forked from aminin/icu-install.sh
Install ICU from source and build php-intl with the specific version of ICU
#!/usr/bin/env bash
if [[ -x $(which php) ]]; then
PHP_ICU_VERSION=$(php -r 'echo defined("INTL_ICU_VERSION") ? INTL_ICU_VERSION : "none";')
echo "PHP ICU version: $PHP_ICU_VERSION"
else
echo 'WARNING: PHP not installed'
PHP_ICU_VERSION=none
fi
@fullpipe
fullpipe / android_instructions.md
Last active December 10, 2017 20:03 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@fullpipe
fullpipe / knuth.go
Created June 16, 2016 20:13 — forked from quux00/knuth.go
Knuth Fisher-Yates shuffle for Go (golang)
// implements Knuth or Fisher-Yates shuffle
package knuth
import (
"math/rand"
"time"
)
func init() {
rand.Seed(time.Now().UTC().UnixNano())
@fullpipe
fullpipe / run-innobackupex.sh
Created June 6, 2016 11:08 — forked from jmfederico/run-xtrabackup.sh
Script to create full/incremental backups with innobackupex script.
#!/bin/sh
TMPFILE="/tmp/innobackupex-runner.$$.tmp"
USEROPTIONS="--user=XXX --password=XXX"
FILTERTABLES="--include=.*[.].*"
BACKDIR=/var/mysql-bak
BASEBACKDIR=$BACKDIR/base
INCRBACKDIR=$BACKDIR/incr
FULLBACKUPLIFE=3600 #604800 # How long to keep incrementing a backup for, minimum 60
KEEP=1 # Keep this number of backups, appart form the one currently being incremented
@fullpipe
fullpipe / gist:93bae0555411d11bd895
Created December 6, 2015 12:15
Install Ruby with rbenv on Ubuntu 14.04
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile