Skip to content

Instantly share code, notes, and snippets.

View eukras's full-sized avatar
💭
Working on refspy

Nigel Chapman eukras

💭
Working on refspy
View GitHub Profile
@eukras
eukras / _variables.scss
Created December 14, 2018 23:39
Simple SASS/SCSS font scaling.
$stepUp: 1.20;
$stepDown: 0.90;
$fontSizePlus3: #{$stepUp * $stepUp * $stepUp}rem;
$fontSizePlus2: #{$stepUp * $stepUp}rem;
$fontSizePlus1: #{$stepUp}rem;
$fontSize: 1rem;
$fontSizeMinus1: #{$stepDown}rem;
$fontSizeMinus2: #{$stepDown * $stepDown}rem;
$fontSizeMinus3: #{$stepDown * $stepDown * $stepDown}rem;
@eukras
eukras / Good Practice (Links)
Last active February 7, 2018 14:48
Good practice notes for Linux CLI Dev
@eukras
eukras / certbot-notes.sh
Last active October 24, 2017 14:39
Certbot/Apache Setup Notes
# Setting up certbot and autorenewal on Apache
sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
cd /opt/letsencrypt
sudo -H ./letsencrypt-auto certonly --standalone -d example.com -d www.example.com
echo '@monthly root /opt/letsencrypt/letsencrypt-auto certonly --quiet --standalone --renew-by-default -d example.com -d www.example.com >> /var/log/letsencrypt/letsencrypt-auto-update.log' | sudo tee --append /etc/crontab
# Add cerificates and redirect to Apache conf
sudo vim /etc/apache2/sites-enabled/example.com # With:
<VirtualHost *:80>
@eukras
eukras / ripping-csv-in-console.php
Created September 18, 2017 04:52
PHP tools for working with CSVs in console.
<?php
function remaining(\Generator $gen)
{
yield from $gen;
}
function readCsv($source)
{
if (($handle = fopen($source, "r")) !== FALSE) {
@eukras
eukras / silex-list-routes-in-console.php
Created September 18, 2017 04:50
Silex App: List routes in console.
<?php
require_once 'vendor/autoload.php';
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Silex\Application;
/**
@eukras
eukras / simple-docker-wordpress.md
Last active September 18, 2017 03:51
A simple Docker Wordpress config

A Simple Docker WordPress

config.env

MYSQL_ROOT_PASSWORD=whatever
WORDPRESS_DB_USER=root
WORDPRESS_DB_PASSWORD=whatever
#WORDPRESS_HOST=192.168.1.1
#WORDPRESS_DB_HOST=192.168.1.1
@eukras
eukras / bottle-docker-aws-elastic-beanstalk.md
Last active July 25, 2017 17:22
Running Python Bottle in AWS Elastic Beanstalk's Docker Containers

Bottle in Beanstalk

# Develop with:
docker build -t my-test .
docker run -p 8080:80 my-test
# Deploy with:
eb init
eb deploy
#!/bin/bash
# For greatest convenience
alias dc='docker-compose'
# Clean up unused containers and images
alias dclean='docker rm $(docker ps -qf "status=exited")'
alias dclean_images='docker rmi $(docker images -qf "dangling=true")'
# Assume dockerized $nginx and $mysql containers...
@eukras
eukras / shortcuts.txt
Last active September 18, 2015 00:03
Some Diagnostic Shortcuts
# Proper tree view of directories (Bash)
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
# Database table sizes (MySQL, MB)
SELECT SUM(data_length / (1024 * 1024)), table_schema, table_name Data_MB FROM information_schema.tables WHERE table_schema NOT IN ('information_schema','performance_schema','mysql') GROUP BY table_schema, table_name;
@eukras
eukras / fix.orm.yml.php
Last active August 29, 2015 14:23
Make doctrine indexes unique in .orm.yml files.
<?php
// When doctrine/orm 2.4 reverse-engineers a MySQL DB, it doesn't make the index names globally unique.
// This is a one-off hack script to fix up unique index names if theer are too many .orm.yml files to fix easily by hand.
// USAGE:
// for f in $(ls -1 ./src/Whatever/Bundle/WhateverBundle/Resources/config/doctrine/*.orm.yml); do \
// php fix-yml.php $f > "${f/doctrine/doctrine-fix}"; \
// done