Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Alex Richards ajtrichards

🏠
Working from home
View GitHub Profile
View gist:b918565b0c32c13ab25a63df4795e42c
### Keybase proof
I hereby claim:
* I am ajtrichards on github.
* I am alexrichards (https://keybase.io/alexrichards) on keybase.
* I have a public key ASDv_Nt0itWm_BtpceiaxDWHtvVxEmNbt-THZBG5DSQDkgo
To claim this, I am signing this object:
View example-log-entry.sh
Feb 3 19:27:50 user-api-*-* user-api WARNING [03-Feb-2018 19:27:50] WARNING: [pool www] child 958 said into stderr: "[2018-02-03 19:27:50] lumen.DEBUG: user.api.view.user.error.user-details {"action":"user.api.view.user.error.user-details","userData":{"forename":"Alex","surname":"Richards","fullname":"Alex Richards","email":"emailaddress@hidden.com","username":"emailaddress@hidden.com","enabled":true,"earn":"earn:user/users:A-UUID-4"}} []"
@ajtrichards
ajtrichards / byte_to_str.go
Last active Jan 22, 2018 — forked from is73/byte_to_str.go
Convert []byte to string in Golang
View byte_to_str.go
func BytesToString(data []byte) string {
return string(data[:])
}
@ajtrichards
ajtrichards / clean-deleted-branches.sh
Created Dec 25, 2017
A command to delete merged branches in GIT
View clean-deleted-branches.sh
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d
View sample-nginx.conf
daemon off;
pid /tmp/nginx.pid;
error_log /dev/stderr info;
worker_processes auto;
events {
worker_connections 1024;
}
http {
@ajtrichards
ajtrichards / lumen-query-log.php
Last active Mar 4, 2019
Laravel Lumen - Display Query Log
View lumen-query-log.php
/**
* You must enable to Query Log when using Lumen.
*/
DB::connection()->enableQueryLog();
$queries = DB::getQueryLog();
$last_query = end($queries);
View sql-date-query.sql
SELECT * FROM tablename WHERE date <= UNIX_TIMESTAMP(STR_TO_DATE('Apr 07 2015 09:00AM', '%M %e %Y %h:%i%p'))
@ajtrichards
ajtrichards / color-bash.sh
Created Sep 13, 2013
Get some color in your shell!
View color-bash.sh
NORMAL=$(tput sgr0)
GREEN=$(tput setaf 2; tput bold)
YELLOW=$(tput setaf 3)
RED=$(tput setaf 1)
function red() {
echo -e "$RED$*$NORMAL"
}
function green() {
@ajtrichards
ajtrichards / client.html
Created Apr 30, 2013
Faye PUB/SUB server
View client.html
<script type="text/javascript" src="http://localhost:8000/faye/client.js"></script>
<script type="text/javascript">
/*
** Script to handle notifications
*/
var client = new Faye.Client('http://localhost:8000/faye',{
timeout: 120
});