Skip to content

Instantly share code, notes, and snippets.

View IngmarBoddington's full-sized avatar

Ingmar Boddington IngmarBoddington

View GitHub Profile
@IngmarBoddington
IngmarBoddington / perl
Last active December 12, 2015 12:19
Perl Notes (5.1+) - Linux | Key: <required>, [optional] | Full function reference: http://perldoc.perl.org/index-functions.html
Principles: There's more than one way to do it! / do what I mean!
GENERAL
=======
use <string>;
- Pragmas, intepreted before script runs
- Use 'strict' and 'warnings' to enforce good syntax
- Also used to import libraries
@IngmarBoddington
IngmarBoddington / pcre
Last active February 28, 2022 13:49
Pearl Compatible Regular Expressions
-. = Any Single character
-+ = One or more of preceding character
-? = Zero or one of preceding character
-* = One or more of preceding character
-^ = Start of string
-$ = End of string
-| = or
-(Escape any of above with \, for literal \ use \\)
-{n} = n of preceding character
-{n,} = At least n of preceding character
@IngmarBoddington
IngmarBoddington / vi
Last active October 6, 2019 19:29
vi shortcuts
COMMAND MODE
i = Enter insert mode
o = Insert after current line (enter insert mode)
O = Insert before current line (enter insert mode)
a = Append after current character (enter insert mode)
A = Append at end of line (enter inset mode)
u = undo
@IngmarBoddington
IngmarBoddington / mysqlTools
Last active August 11, 2017 10:35
Command line mysql tools
Note that all of these clients take standard mysql client options, e.g. host / password etc
mysqladminm
- Issue one off commands
- http://dev.mysql.com/doc/refman/5.6/en/mysqladmin.html
mysqladmin [options] command [command-arg] [command [command-arg]] ...
@IngmarBoddington
IngmarBoddington / twig
Created February 28, 2013 11:30
Twig Templating basics (in Symfony) | Key: <required_value>, [optional]
Template naming convention
<bundle>:<controller>:<template>
<bundle> translates to /src/BundleStart/BundleEnd/ (e.g. AcmeBlogBundle -> src/Acme/BlogBundle)
<controller> means template in /Resources/Views/<controller>
<template> is actual name of file in format <name>.<format>.<engine> e.g. index.html.php or smeg.xml.twig
::base.html.twig means template in application wide dir i.e. app/Resources/Views/
{{ <variable> }} - Output value
@IngmarBoddington
IngmarBoddington / statusCodes
Last active March 22, 2024 21:35
HTTP Status Codes / Verbs List
CONNECT
DELETE
GET
HEAD
OPTIONS
PATCH
POST
PUT
TRACE
@IngmarBoddington
IngmarBoddington / shellScripting
Last active February 14, 2022 17:23
Notes on shell scripting in Linux. Should be used in conjunction with terminal notes: https://gist.github.com/IngmarBoddington/4226355
Basics
======
Expansion (special symbols replaced by values) and word splitting (arguments being split into several aruments) must have attemtion paid or pain will follow.
- # for comments
- Lots of internal variables available to bash scripts, see: http://tldp.org/LDP/abs/html/internalvariables.html#ARGLIST
- Name of script will be $0
- Parameters passed to script will be in $1, $2, $3.... vars and count in $#
@IngmarBoddington
IngmarBoddington / template-gists.php
Last active December 15, 2015 06:29
WordPress template for simply listing a user's Gists on GitHub
<?php
/**
Template Name: Gists
*/
get_header(); ?>
<div id="container">
<div id="content" role="main">
<h1 class="entry-title">Gists</h1>
<hr /><br />
@IngmarBoddington
IngmarBoddington / .htaccess
Created March 24, 2013 21:07
All sorts of .htaccess fixes, redirects and security related settings
#Front Controller rewrite
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [L,NC]
# Ensure we are using HTTPS
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@IngmarBoddington
IngmarBoddington / xdebug
Last active December 14, 2021 00:05
Xdebug ini settings, functions and general use.
Enable tracing example:
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.auto_trace=1
xdebug.trace_output_dir="/tmp/xdebug/"
xdebug.collect_params=4
xdebug.collect_return=1
xdebug.trace_options=1
xdebug.show_local_vars=1