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
/*eslint-disable no-undef*/ | |
import timeit from 'timeit' | |
import { createMatcher } from '../../../src/create-matcher' | |
fdescribe('Bench', function () { | |
const data = [] | |
for (let i = 0; i < 100; i++) { | |
const path = `/static/${i}` |
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
const pathToRegexp = require('path-to-regexp') | |
const timeit = require('timeit') | |
const matcher = pathToRegexp('/a/b') | |
const matcherSimple = { | |
'/a/b': true | |
} | |
function use_regexp(done) { | |
matcher.exec('/a/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
data "http" "gocache_response" { | |
url = "https://gocache.com.br/ips" | |
} | |
resource "aws_ec2_managed_prefix_list" "gocache" { | |
name = "gocache ips" | |
address_family = "IPv4" | |
max_entries = 30 | |
dynamic "entry" { |
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
{"lastUpload":"2021-04-04T15:12:08.525Z","extensionVersion":"v3.4.3"} |
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.query import ModelIterable | |
class BaseSerializer: | |
SELECT_RELATED = [] | |
PREFETCH_RELATED = [] | |
def prepare_queryset(self, qs): | |
if self.SELECT_RELATED: |
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
$ python main.py | |
Bottle server starting up (using WSGIRefServer())... | |
Listening on http://127.0.0.1:8080/ | |
Hit Ctrl-C to quit. | |
wsgilog.log: Thu, 06 Sep 2012 07:50:38 INFO Before request to GET /hello/bottle | |
wsgilog.log: Thu, 06 Sep 2012 07:50:38 INFO After request to GET /hello/bottle | |
iurisilvio - - [06/Sep/2012 07:50:38] "GET /hello/bottle HTTP/1.1" 200 20 | |
iurisilvio - - [06/Sep/2012 07:50:38] "GET /favicon.ico HTTP/1.1" 404 742 |
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
In [1]: from django.conf import settings | |
...: from django.utils.module_loading import import_string | |
...: | |
...: | |
...: class ServiceFactory: | |
...: def __init__(self, django_setting): | |
...: self._django_setting = django_setting | |
...: | |
...: def __call__(self, import_str=None): | |
...: if import_str is None: |
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
TMP_CONF=/tmp/awsips.conf | |
NGINX_CONF=/etc/nginx/conf.d/awsips.conf | |
AWS_REGION=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document | jq .region | tr -d \") | |
if ! sudo nginx -t; then | |
echo CURRENT NGINX CONFIG IS BROKEN | |
exit 1 | |
fi | |
curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r ".prefixes[] | select(.region==\"$AWS_REGION\" and .service==\"AMAZON\").ip_prefix" | xargs -i echo set_real_ip_from {}\; | sort > $TMP_CONF |
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
<style type="text/css" scoped> | |
.mauticform_wrapper { max-width: 600px; margin: 10px auto; } | |
.mauticform-innerform {} | |
.mauticform-post-success {} | |
.mauticform-name { font-weight: bold; font-size: 1.5em; margin-bottom: 3px; } | |
.mauticform-description { margin-top: 2px; margin-bottom: 10px; } | |
.mauticform-error { margin-bottom: 10px; color: red; } | |
.mauticform-message { margin-bottom: 10px;color: green; } | |
.mauticform-row { display: block; margin-bottom: 20px; } |
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
fibs = {0: 0, 1: 1} | |
def _fib(n): | |
if n in fibs: return fibs[n] | |
if n % 2 == 0: | |
fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2) | |
return fibs[n] | |
else: | |
fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2) | |
return fibs[n] |
NewerOlder