This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.db.models import F | |
class TestModel(models.Model) | |
uid = models.IntegerField() | |
big_complicated_name = models.CharField() | |
TestModel.objects.annotate(name=F('big_complicated_name')) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This module provides a simple WSGI profiler middleware for finding | |
bottlenecks in web application. It uses the profile or cProfile | |
module to do the profiling and writes the stats to the stream provided | |
To use, run `flask_profiler.py` instead of `app.py` | |
see: http://werkzeug.pocoo.org/docs/0.9/contrib/profiler/ | |
and: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-debugging-testing-and-profiling | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Learn where | |
x = 10 | |
* 5 | |
+ y -- why is this not a parse error, isn't this incorrect indentation | |
myResult = x * 5 | |
y = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Pg81 where | |
x + 9001 | |
where x = 10 | |
-- c where a = b | |
-- is the same as | |
-- let a = b in c | |
-- is the same as | |
-- (\a -> c) b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set-option -g default-command "reattach-to-user-namespace -l zsh" | |
# List of plugins | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'tmux-plugins/tmux-sensible' | |
set -g @plugin 'tmux-plugins/tmux-resurrect' | |
set -g @plugin 'tmux-plugins/tmux-continuum' | |
set -g @plugin 'tmux-plugins/tmux-open' | |
#set -g @plugin 'jimeh/tmux-themepack' | |
# Key bindings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_branch_name = { name -> | |
jira_issue_re = /.*\(((?<!([A-Z]{1,10})-?)[A-Z]+-\d+)\)$/ // any chars followed by jira issue ID at the end | |
pr_type_re = /^(?i)(bugfix|enhancement|feature|hotfix)-.*/ // pr type followed by any chars | |
name =~ jira_issue_re && name =~ pr_type_re | |
} | |
check_branch_name "BGfix-hello world-(CN-85)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call plug#begin('~/.vim/plugged') | |
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' } | |
Plug 'https://github.com/tpope/vim-sensible' | |
Plug 'https://github.com/tpope/vim-surround' | |
Plug 'https://github.com/tpope/vim-repeat' | |
Plug 'https://github.com/kien/ctrlp.vim' | |
Plug 'https://github.com/vim-scripts/auto-pairs-gentle' | |
Plug 'https://github.com/airblade/vim-gitgutter' | |
Plug 'https://github.com/eagletmt/ghcmod-vim.git' | |
"Plug 'https://github.com/c0r73x/neotags.nvim.git' < using tagbar instead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# open streams | |
``` | |
stdin_open: true | |
tty: true | |
``` | |
# run this to get into console | |
docker attach <instance> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you use bash, this technique isn't really zsh specific. Adapt as needed. | |
source ~/keychain-environment-variables.sh | |
# AWS configuration example, after doing: | |
# $ set-keychain-environment-variable AWS_ACCESS_KEY_ID | |
# provide: "AKIAYOURACCESSKEY" | |
# $ set-keychain-environment-variable AWS_SECRET_ACCESS_KEY | |
# provide: "j1/yoursupersecret/password" | |
export AWS_ACCESS_KEY_ID=$(keychain-environment-variable AWS_ACCESS_KEY_ID); | |
export AWS_SECRET_ACCESS_KEY=$(keychain-environment-variable AWS_SECRET_ACCESS_KEY); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from influxdb import InfluxDBClient | |
db = "ci-metrics-testing" | |
client = InfluxDBClient("localhost", 8086, "root", "root", db) | |
client.create_database(db) # TODO: check if this overrites previous db | |
days = [ | |
# 1 | |
{ | |
"measurement": "commits", |
OlderNewer