Skip to content

Instantly share code, notes, and snippets.

Avatar
🐗

Bartek Ciszkowski bartek

🐗
View GitHub Profile
@bartek
bartek / pre-commit
Created Dec 10, 2018 — forked from pbhandari/pre-commit
pre commit hook for running pylint
View pre-commit
#!/bin/sh
DESIRED_VENV=compass
if [ -z $VIRTUAL_ENV ] || [ "`basename $VIRTUAL_ENV`" != "$DESIRED_VENV" ]; then
echo You\'re not in the $DESIRED_VENV virtualenv, \`workon $DESIRED_VENV\` to fix.
exit 1
fi
RCFILE="`git rev-parse --show-toplevel`"/.pylintrc
@bartek
bartek / tutorial.md
Created Jul 25, 2018 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API
View tutorial.md

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

View dns tuning ssh login speedup vagrant
- Tune /etc/ssh/sshd_config
UseDNS no # Disable DNS lookups
GSSAPIAuthentication no # Disable negotation of slow GSSAPI
don't forget to restart it, use a script provider to set it , or create it with veewee or snapshot it
- Tune Vagrantfile
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
View gist:0e751057c78b82689be4
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
),
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
View prompt
# Prompt Colors
RED="\[\033[0;31m\]"
PINK="\[\033[1;31m\]"
YELLOW="\[\033[1;33m\]"
GREEN="\[\033[0;32m\]"
LT_GREEN="\[\033[1;32m\]"
BLUE="\[\033[0;34m\]"
WHITE="\[\033[1;37m\]"
PURPLE="\[\033[1;35m\]"
CYAN="\[\033[1;36m\]"
@bartek
bartek / index.js
Created Jun 12, 2015
requirebin sketch
View index.js
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var request = require('superagent'),
_ = require('lodash')
function collectResponse(err, resp) {
var results = document.getElementById('results')
_.each(resp.body.results, function(item) {
var child = document.createElement("div")
child.innerHTML = item.product_line + " -- " + item.departures_start_date
@bartek
bartek / index.js
Created Jun 9, 2015
requirebin sketch
View index.js
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var request = require('superagent'),
_ = require('lodash')
function collectResponse(err, resp) {
var results = document.getElementById('results')
_.each(resp.body.results, function(item) {
var child = document.createElement("div")
child.innerHTML = item.product_line + " -- " + item.departures_start_date
View browserify.md

Learn you a browserify

We want to learn:

  • What is NPM
  • Dependencies installation
  • Initially package.json for your project
  • Project workflow:
    • Begin writing code
    • Require dependencies
View -
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6WH/85Y1ShcZWCq29dLpapwe2q7g3pSScybaJuYGO0gxfCDWEYr8+kadw5GB7vIQJvUcK+XLgurWRtjrVYMIfuWsHW1VG8Aq2GEh3UiWbew8l07xcAQTRhdWboZnYszf+72jkK72do42sp5GblQKp6iFtml6sEgL2BtpJojdkrs8j8wocAmFAgdYKmkcPTGRhxCP7actWd7rNyn0Tc4GW5kQLyzajQoEMLjtzVNniXqIue2/iydoQCCKLGGsWLQ0VQCXzb++30atda4dzdGy0tQBMV4osYcXKNSuroCK29v8vLhtpVrfAY9k3IAxJsyu0Qd7Wr931F5Rqlso0gNKwQ== bartekc@dhcp147.gap.ca
View -
{"id": "35921", "href": "https://rest.gadventures.com/promotions/35921", "name": "Last Minute 10% off CRPJ141102", "promotion_code": "LM10CRPJ141102", "discount_amount": null, "discount_percent": "10.00", "commission_rate": null, "min_travellers": 0, "sale_start_date": "2014-09-02", "sale_finish_date": "2014-10-02", "product_start_date": null, "product_finish_date": null, "terms_and_conditions": null, "currencies": ["CAD", "CHF", "EUR", "AUD", "USD", "GBP", "NZD", "ZAR"], "room_codes": null, "flags": ["APPLY_AUTOMATICALLY"], "products": [{"id": "506398", "href": "https://rest.gadventures.com/departures/506398", "type": "departures", "sub_type": "Tour"}]}