Skip to content

Instantly share code, notes, and snippets.

View ajtrichards's full-sized avatar
🏠
Working from home

Alex Richards ajtrichards

🏠
Working from home
  • South Wales
View GitHub Profile
@ajtrichards
ajtrichards / sql-date-query.sql
Created April 7, 2015 08:44
Unix Date SQL query
SELECT * FROM tablename WHERE date <= UNIX_TIMESTAMP(STR_TO_DATE('Apr 07 2015 09:00AM', '%M %e %Y %h:%i%p'))
@ajtrichards
ajtrichards / client.html
Created April 30, 2013 09:37
Faye PUB/SUB server
<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
});
@ajtrichards
ajtrichards / color-bash.sh
Created September 13, 2013 13:26
Get some color in your shell!
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() {
daemon off;
pid /tmp/nginx.pid;
error_log /dev/stderr info;
worker_processes auto;
events {
worker_connections 1024;
}
http {
@ajtrichards
ajtrichards / clean-deleted-branches.sh
Created December 25, 2017 19:24
A command to delete merged branches in GIT
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d
@ajtrichards
ajtrichards / byte_to_str.go
Last active January 22, 2018 19:47
Convert []byte to string in Golang
func BytesToString(data []byte) string {
return string(data[:])
}
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"}} []"
### 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:
SELECT id, TIMEDIFF(ended_at, started_at) as timediff FROM ...
@ajtrichards
ajtrichards / gist:cfab61de1b570340bb55ae8b24fff258
Created May 21, 2021 14:39
AWS S3 - Delete files from a bucket with a prefix
aws s3 rm s3://BUCKET_NAME --recursive --exclude "*" --include "FILE_PREFIX-W*"