Skip to content

Instantly share code, notes, and snippets.

View stringsn88keys's full-sized avatar

Thomas Powell stringsn88keys

View GitHub Profile
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 23, 2024 19:14
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%'
@janaz
janaz / get-aws-console-url.js
Last active March 27, 2024 12:05
Generate AWS console URL from the credentials stored in environment variables
/**
* This little program prints out the url to the AWS console
* generated from the local AWS credentials stored in environment variables:
* AWS_ACCESS_KEY_ID
* AWS_SECRET_ACCESS_KEY
* AWS_SESSION_TOKEN
*
* Steps:
* 1. Create a JSON object
* session = JSON.stringify({
@retorillo
retorillo / latex2png_win.md
Last active February 22, 2024 10:51
LaTeX to PNG on Windows

LaTeX to PNG on Windows

Prerequisite

  • Windows System (Tested on Windows 10)
  • pdflatex TexLive (/w standalone package)
  • magick Image Magick
    • choco install imagemagick
  • gswin32c Ghost Script (x86)
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@galexrt
galexrt / hb_all_books_dl.js
Last active January 17, 2020 12:22 — forked from kfatehi/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
this fork downloads all formats and does so without using jquery (since that didnt work for me)
note that if you are in chrome, chrome will not download the pdfs for you by default, to fix this
type “about:plugins” in the address bar and disable chrome's pdf viewer
*/
var pattern = /(ZIP|MOBI|EPUB.*|PDF|PDF( ?\(H.\))?|CBZ|PRC|Download|Supplement)$/i;
@searls
searls / hue-ci
Last active June 27, 2016 17:25
Tying up Philips Hue lights to the exit-code status of my shell
#!/usr/bin/env node
/**
* Activates all Philips Hue scenes for a given name, optionally
* restricted to a particular group (the new app seems to make scenes universal
* across groups so it may be necessary to look up the group ID associated with
* the room you want to be affected.
*
* Example usage:
*