Skip to content

Instantly share code, notes, and snippets.

View jlawsonb's full-sized avatar

J. Lawson jlawsonb

View GitHub Profile
@matschaffer
matschaffer / gist:4912279e49dce41ab9b2
Last active July 6, 2021 13:05
Bash-friendly ec2 prices
#!/usr/bin/env bash
URL="http://a0.awsstatic.com/pricing/1/ec2/ri-v2/linux-unix-shared.min.js"
(echo 'function callback(data) { console.log(JSON.stringify(data)); }'; curl -s "$URL") |\
node |\
jq -r '.config.regions[] |
select(.region == "us-east-1") |
.instanceTypes[] |
[
@Prithvirajbilla
Prithvirajbilla / getfeed.php
Created October 27, 2014 12:45
Get feed From URL with Basic Authorisation
<?php
function getfromweb($url, $username = null, $password = null) {
$opts = array('http' =>
array(
'method' => 'GET',
'header' => "Authorization: Basic ".base64_encode("$username:$password")."\r\n")
);
$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context);
return $result;
@phindmarsh
phindmarsh / Vagrantfile
Created September 18, 2014 08:30
NFS issue when using Vagrant and Docker
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider "docker" do |d|
d.vagrant_vagrantfile = "./Vagrantfile.proxy"
end
config.vm.define "container" do |v|
v.vm.provider "docker" do |d|
@abulte
abulte / backup_glacier.py
Created November 15, 2012 17:09
Simple AWS Glacier backup for files and MySQL DB
#!/usr/bin/env python
import sys
from datetime import datetime
import subprocess
DB_LOGIN = 'root'
DB_PASSWD = 'XXXX'
VAULT_NAME = 'backup_sunny'
HOSTNAME = 'Sunny'
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 31, 2024 12:52
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@handerson
handerson / mysqlfix.sh
Created March 27, 2012 16:52 — forked from davejlong/mysql client
How to setup the MySQL client and MySQLDump client on Mac OS x from MySQL Workbench
#MySQL Client
ln -s /Applications/MySQLWorkbench.app/Contents/Resources/mysql /usr/bin/mysql
#MySQL Dump
ln -s /Applications/MySQLWorkbench.app/Contents/Resources/mysqldump /usr/bin/mysqldump
#How to fix the "Library not loaded: libmysqlclient.18.dylib (LoadError)" error
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
@hacklschorsch
hacklschorsch / mysql_backup_cron
Created December 5, 2011 10:28
Rolling MySQL snapshots in two lines of code
# Scope: Back up the MySQL database
# Author: Florian Sesser <fs@it-agenten.com>
# Date: 2011-11-11, 2011-12-05
# This script is to be placed into /etc/cron.d/ (it's a cron config file)
# We are on a debian-based distribution and use the debian-sys-maint
# account. If you need to create an account for backup purposes, it
# has to have permissions to "read" and "lock tables:
#