Skip to content

Instantly share code, notes, and snippets.

@rcousens
rcousens / attach_ebs.sh
Created August 15, 2023 03:28 — forked from pwillis-els/attach_ebs.sh
Bash script to attach an EBS volume to an EC2 instance after boot-time
#!/bin/sh
# attach_ebs.sh - Attach an EBS volume to an EC2 instance.
# Copyright (C) 2020 Peter Willis <[email protected]>
#
# This script is designed to create and mount a single EBS volume based on its tag:Name
# in order to implement persistent storage. If there is more than one EBS volume
# with the same tag, this script will fail.
#
# Order of operations:
# 1. Detect EBS volume based on "tag:Name" "$TAG_NAME"
@rcousens
rcousens / postgres_queries_and_commands.sql
Created April 4, 2023 00:32 — forked from rgreenjr/postgres_queries_and_commands.sql
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%'
@rcousens
rcousens / install-pacaur.sh
Created December 5, 2016 01:45 — forked from ansemjo/install-pacaur.sh
A small script for arch linux which builds and installs "pacaur" automatically
#!/bin/sh
#
# LICENSE AT END OF FILE
#
# This is a script to automatically install pacaur from the AUR. It is
# intended for fresh systems with no other means to install from AUR.
# Theoretically, this script can install other packages too. Just modify
# the $aurpkgs variable below.
#
@rcousens
rcousens / Symfony2PasswordEncode.js
Created June 14, 2016 07:39 — forked from konstantinzolotarev/Symfony2PasswordEncode.js
Function for node.js that will encrypt password exactly like Symfony2 PHP framework. So all passwords from Symfony2 will work in your node.js application
'use strict';
var crypto = require('crypto');
var _ = require('lodash');
/**
* Will encrypt password in Symfony2 way using a given salt.
*
* @param {string} password
* @param {string} salt
[Unit]
Description=Powertop
[Service]
Type=oneshot
Environment=TERM=linux
ExecStart=/usr/sbin/powertop --auto-tune
[Install]
WantedBy=multi-user.target
@rcousens
rcousens / test.js
Created September 5, 2014 11:40
test.js
(function() {
console.log('we are live');
})();