Skip to content

Instantly share code, notes, and snippets.

View aisayko's full-sized avatar
💭
I may be slow to respond.

Alex Isayko aisayko

💭
I may be slow to respond.
View GitHub Profile
@sandfox
sandfox / add-metric-filters.sh
Created January 12, 2019 00:32
Add AWS cloudwatch log metrics filter to graph memory usage by lambda
#! /usr/bin/env sh
##
# Notes:
# Log line:
# REPORT RequestId: f420d819-d07e-11e8-9ef2-4d8f649fd167 Duration: 158.15 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 38 MB
# [ report_label="REPORT", ..., label="Used:", max_memory_used_value, unit="MB" ]
#
# Test the metric filter
# aws logs test-metric-filter \
@doobeh
doobeh / bulk_updates_sqlalchemy.py
Created September 8, 2015 18:24
SQLAlchemy bulk updates.
""" Quick example showing how to do a bulk update into the database
using SQLAlchemy, without interacting heavily with the ORM.
"""
from sqlalchemy.sql.expression import bindparam
stmt = addresses.update().\
where(addresses.c.id == bindparam('_id')).\
values({
'user_id': bindparam('user_id'),
'email_address': bindparam('email_address'),
@Dimitri-Gnidash
Dimitri-Gnidash / gist:5999939
Created July 15, 2013 13:28
Thoughtful Team
Building with Confidence
- Investment into quality i.e. spending time improving infrastructure, refactoring code, looking for better solutions (CRITICAL)
- Once a week half a day bug hunt with dev team or full-time Automated QA Engineer
- Demanding and giving developers time to do proper testing of their own effort.
- Test-driven development (or BDD) and Continuous Integration
- Code reviews
- Investment into writing library-style code
Running Tight Ship
- Pre-planning meeting where the dev teams play "Planning poker" (CRITICAL)
@cauethenorio
cauethenorio / i18n_routing.py
Created February 13, 2013 20:56
Django snippet to make Django do not create URL language prefix for the main language (settings.LANGUAGE_CODE) Usage info in snippet docstring.
# coding: utf-8
"""
Cauê Thenório - cauelt(at)gmail.com
This snippet makes Django do not create URL languages prefix (i.e. /en/)
for the default language (settings.LANGUAGE_CODE).
It also provides a middleware that activates the language based only on the URL.
This middleware ignores user session data, cookie and 'Accept-Language' HTTP header.
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 1, 2024 13:31
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%'