Skip to content

Instantly share code, notes, and snippets.

View adamantnz's full-sized avatar
:shipit:

Adam adamantnz

:shipit:
  • Fluidly
  • London
View GitHub Profile
@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')
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 14, 2025 00:29
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%'
@patmanv
patmanv / RedMeta.sql
Last active February 12, 2024 21:12
Red Meta Queries
----------------------------------------------------------------------------------------------------
-- <<< system tables >>>
----------------------------------------------------------------------------------------------------
-- get RED meta data tables
SELECT *
FROM sys.objects
WHERE (name LIKE 'ws_%' or name LIKE 'dss_%ac%' )
AND type = 'U'
ORDER BY 1
@henrysher
henrysher / reinvent.md
Last active October 9, 2024 15:54
link for reinvent slides
@venning
venning / standard_deviation.js
Created October 17, 2015 09:10
Standard Deviation with lodash
// NOTE requires lodash v3.4.0+ (for _.sum) and Node 4.0+ (for arrow function)
var _ = require('lodash');
function σ (array) {
var avg = _.sum(array) / array.length;
return Math.sqrt(_.sum(_.map(array, (i) => Math.pow((i - avg), 2))) / array.length);
};
@tonysneed
tonysneed / Mac OS X: Open in Visual Studio Code
Last active March 29, 2025 18:40
Add a command to Finder services in Mac OSX to open a folder in VS Code
- Open Automator
- File -> New -> Service
- Change "Service Receives" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*"
- Save it as something like "Open in Visual Studio Code"
@erikbern
erikbern / use_pfx_with_requests.py
Last active April 10, 2025 07:17
How to use a .pfx file with Python requests – also works with .p12 files
import contextlib
import OpenSSL.crypto
import os
import requests
import ssl
import tempfile
@contextlib.contextmanager
def pfx_to_pem(pfx_path, pfx_password):
''' Decrypts the .pfx file to be used with requests. '''
@criccomini
criccomini / airflow-supervisord.conf
Created June 22, 2016 14:54
airflow-supervisord.conf
; Configuration for Airflow webserver and scheduler in Supervisor
[program:airflow]
command=/bin/airflow webserver
stopsignal=QUIT
stopasgroup=true
user=airflow
stdout_logfile=/var/log/airflow/airflow-stdout.log
stderr_logfile=/var/log/airflow/airflow-stderr.log
environment=HOME="/home/airflow",AIRFLOW_HOME="/etc/airflow",TMPDIR="/storage/airflow_tmp"
@dwilkie
dwilkie / docker-cheat-sheat.md
Last active May 12, 2024 14:08
Docker Cheat Sheet

Build docker image

$ cd /path/to/Dockerfile
$ sudo docker build .

View running processes

@nvquanghuy
nvquanghuy / mysql.sql
Last active January 21, 2021 07:39
Unnesting strings in Redshift and MySQL
create table books (tags varchar(1000));
insert into books values
('A, B, C, D'),
('D, E'),
('F'),
('G, G, H')
;
select