Consider this blog post model:
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
require 'rubygems' | |
require 'yaml' | |
# A demonstration of YAML anchors, references and handling of nested values | |
# For more info, see: | |
# http://atechie.net/2009/07/merging-hashes-in-yaml-conf-files/ | |
stooges = YAML::load( File.read('stooges.yml') ) | |
# => { | |
# "default" => { |
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
define -mem-heap-dump-chunk | |
printf "%#016x: ", $mem_addr | |
printf "%016lu %016lu %#02x ", ((long *)$mem_addr)[0], ((long *)$mem_addr)[1] & ~3, ((long*)$mem_addr)[1] & 3 | |
printf "%016x %016x\n", ((long *)$mem_addr)[2], ((long *)$mem_addr)[3] | |
set $mem_addr = $mem_addr + ((long *)$mem_addr)[1] & ~3 | |
end | |
document -mem-heap-dump-chunk | |
!!! FOR INTERNAL USE ONLY - DO NOT CALL !!! | |
end |
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.core.management.base import BaseCommand, CommandError | |
from django.db.models import get_models, get_app, fields | |
from django.db.models.fields import related | |
class Command(BaseCommand): | |
help = """Generate factory-boy factories for the given app""" | |
def handle(self, *args, **options): | |
assert len(args) == 1, 'Must specify app name as first and only argument' |
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
#!/usr/bin/python | |
import ast, _ast, os | |
for root, dirs, files in os.walk('.'): | |
for name in files: | |
if name.endswith('.py'): | |
full = os.path.join(root, name) | |
t = ast.parse(open(full).read()) | |
for n in ast.walk(t): | |
if isinstance(n, _ast.Str) and not isinstance(n.s, unicode): |
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
window.console.loge = function (msg) { | |
var gifs = ['wink','shake-space','peepers','prizza','hat','gradient','fat','rainbow','sunglasses','derp','shake'], | |
wow = ['', 'wow! ', 'amaze! ', 'dazzle! '], | |
adjs = ['so', 'such', 'many', 'much', 'very'], | |
randomizr = function (a) { return a[Math.floor(Math.random() * a.length)];}, | |
message = '%c ' + randomizr(wow) + randomizr(adjs) + ' ' + typeof msg + ': ', | |
css = 'background: url(http://d1e3ezyatlol8u.cloudfront.net/img/212/doge-' + randomizr(gifs) + '-212.gif) no-repeat 0 0; background-size: 80px 80px; font-family: \'Comic Sans MS\', cursive; text-shadow: 0 1px 1px rgba(0,0,0,1); font-size: 14px; padding: 25px; line-height: 70px; color: #fff; font-weight: 100;'; | |
console.log.apply(console, typeof msg === 'object' ? [message, css, msg] : [message += msg, css]); | |
}; |
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
#!/bin/bash | |
# Main credit goes to joostrijneveld on github: | |
# Ref: https://gist.github.com/joostrijneveld/59ab61faa21910c8434c | |
# adopted to "I want to have a pdf with a textual AND QR key to directly | |
# print it and put it in the bank safe" needs by Jan Stuehler, | |
# 2015-10-05. | |
if [ $# -lt 2 ] | |
then | |
echo "Please specify [Key ID] and an arbitrary [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
/* | |
Forked from https://gist.github.com/arantius/3123124 | |
The MIT License (MIT) | |
Copyright (c) 2014 Anthony Lieuallen | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
In order to get a general idea of how k6 is performing, and to see if there are any low-hanging fruit in terms of optimizations we could do, I did a series of tests running k6 against a local server, testing different changes to the k6 code base.
macOS High Sierra 10.13.13
MacBook Pro(Retina, 15-inch, Mid 2014)
Processor: 2,2Ghz Intel Core i7
Memory: 16GB 1600MHz DDR3
OlderNewer