This file contains hidden or 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
| # Which statement looks most like the english sentence below? | |
| # Peter, go to the kitchen, get some eggs, make an omelette | |
| # this? | |
| peter.go_to_the_kitchen.get_some_eggs.make_an_omelette | |
| # or this? | |
| peter.goToTheKitchen.getSomeEggs.makeAnOmelette |
This file contains hidden or 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
| package ESP::Template::Provider; | |
| use parent 'Template::Provider'; | |
| use Dancer qw[:syntax]; | |
| use Dancer::Plugin::Meerkat; | |
| sub _template_content { | |
| my $path = shift; | |
| return meerkat->db->collection('Template')->find_one({ path => $path }); |
This file contains hidden or 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
| # return a list of templates | |
| get '/template' { | |
| # returns a list of template names | |
| } | |
| sub _get_template_by_name { | |
| return meerkat->db->collection('Template')->find_one({ name => shift }); | |
| } | |
| # gets a single template |
This file contains hidden or 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
| get qr{/(\S+)/interfaces/(\S+)} => sub { | |
| my ($paid, $int) = splat; | |
| # ...codez | |
| } |
This file contains hidden or 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 timeit import Timer | |
| a = 3425.4542542 | |
| b = 45.542542 | |
| def fmt_via_mod_nopad(x): # this doesn't pad the length of the output | |
| return int(((x/10**3)%1)*(10**3)) | |
| def fmt_via_mod_wpad(x): |
This file contains hidden or 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 timeit import Timer | |
| a = 3425.4542542 | |
| b = 45.542542 | |
| def fmt_via_mod_nopad(x): # this doesn't pad the length of the output | |
| return int(((x/10**3)%1)*(10**3)) | |
| def fmt_via_mod_wpad(x): |
This file contains hidden or 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 timeit import Timer | |
| a = 3425.4542542 | |
| b = 45.542542 | |
| def fmt_via_mod_nopad(x): # this doesn't pad the length of the output | |
| return int(((x/10**3)%1)*(10**3)) | |
| def fmt_via_mod_wpad(x): |
This file contains hidden or 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
| import logging | |
| import sys | |
| import traceback | |
| from pdb import set_trace | |
| from logstash_formatter import LogstashFormatterV1 | |
| logger = logging.getLogger() | |
| handler = logging.StreamHandler() | |
| formatter = LogstashFormatterV1() | |
| handler.setFormatter(formatter) |
This file contains hidden or 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
| import logging | |
| import sys | |
| import traceback | |
| from pdb import set_trace | |
| from logstash_formatter import LogstashFormatterV1 | |
| logger = logging.getLogger() | |
| handler = logging.StreamHandler() | |
| formatter = LogstashFormatterV1() | |
| handler.setFormatter(formatter) |
This file contains hidden or 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
| location /redis/ { | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-Host $host; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_buffering off; | |
| proxy_pass http://monitor:4002/; | |
| proxy_redirect off; | |
| } |