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 redis | |
| import logging | |
| class RedisLogHandler: | |
| """Log handler for logging logs in some redis list | |
| """ | |
| def __init__(self, host = None, port = None, db = 0, log_key = 'log_key'): | |
| self._formatter = logging.Formatter() | |
| self._redis = redis.Redis(host = host or 'localhost', port = port or 6379, db = db) | |
| self._redis_list_key = log_key |
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
| go/bin/controller-gen "crd:trivialVersions=true" rbac:roleName=manager-role webhook paths="./api/...;./controllers/..." output:crd:artifacts:config=config/crd/bases | |
| runtime: goroutine stack exceeds 1000000000-byte limit | |
| fatal error: stack overflow | |
| runtime stack: | |
| runtime.throw(0x1784a61, 0xe) | |
| /usr/local/go/src/runtime/panic.go:617 +0x72 | |
| runtime.newstack() | |
| /usr/local/go/src/runtime/stack.go:1041 +0x6f0 | |
| runtime.morestack() |
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 main | |
| import ( | |
| "context" | |
| "fmt" | |
| "os" | |
| "k8s.io/api/core/v1" | |
| _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" | |
| "sigs.k8s.io/controller-runtime/pkg/client" |
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 main | |
| import ( | |
| "fmt" | |
| "os" | |
| "path/filepath" | |
| "regexp" | |
| "strings" | |
| "time" |
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 base64 | |
| import hashlib | |
| import hmac | |
| import simplejson as json | |
| def base64_url_decode(inp): | |
| padding_factor = (4 - len(inp) % 4) % 4 | |
| inp += "="*padding_factor | |
| return base64.b64decode(unicode(inp).translate(dict(zip(map(ord, u'-_'), u'+/')))) |
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
| val = redis.call('zrange', KEYS[1], 0, 0) | |
| if val then redis.call('zremrangebyrank', KEYS[1], 0, 0) end | |
| return val |
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
| function freeze_db() { | |
| rc = db.runCommand({fsync: 1, lock: 1}); | |
| if (rc.ok == 1){ | |
| return 1; | |
| } else { | |
| return 0; | |
| } | |
| } | |
| freeze_db(); |
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 json | |
| from google.appengine.ext import db | |
| from datetime import datetime | |
| from base import BaseHandler | |
| import logging | |
| from models.emails import EmailContent | |
| log = logging.getLogger(__name__) | |
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 datetime | |
| from google.appengine.ext import db | |
| class Image(db.Model): | |
| """Model to represent Image | |
| """ | |
| name = db.StringProperty(required = True) | |
| data = db.TextProperty(required = True) | |
| created_at = db.DateTimeProperty(auto_now_add = True) | |
| updated_at = db.DateTimeProperty(auto_now = False) |
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
| async_if = (fn, args, timeout)-> | |
| dfd = new jQuery.Deferred() | |
| curr_probe = null | |
| probe = ()-> | |
| if fn(args) | |
| dfd.resolve(args) | |
| curr_probe = null | |
| else | |
| curr_probe = setTimeout probe, 5 |
NewerOlder