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
# This experiment stemmed from the need to fetch and pass secrets into | |
# an app container without using a shared volume or sidecar container. | |
# | |
# In this example, as both the action to set the initial secret values | |
# and update them with newer values are all inlined in the script, we'll | |
# be tricking kubectl by adding spec.template.metadata.labels.update, | |
# which we can later enable before reapplying the manifest (and thus triggering | |
# the secrets update/patch process). | |
# | |
apiVersion: apps/v1 |
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" | |
) | |
var ( | |
bankNotes = []int{100000, 50000, 20000, 10000, 5000, 2000, 1000} | |
) |
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" | |
"math/rand" | |
"os" | |
"os/exec" | |
"strconv" | |
"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
package main | |
import ( | |
"errors" | |
"fmt" | |
"os" | |
"reflect" | |
"strconv" | |
"strings" | |
) |
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
def luhn(card_no): | |
card_no = str(card_no) | |
pp = "INVALID" | |
card_specs = { | |
"AMEX": { | |
"prefix": ["34", "37"], | |
"max_len": [15] | |
}, | |
"VISA": { | |
"prefix": ["4"], |
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 | |
conn = redis.StrictRedis.from_url("redis://localhost:6379/0") | |
set_name = "set-containing-elements-to-draw" | |
def draw(conn, set_name, how_many=1): | |
import time | |
while True: | |
try: | |
# continuously print available tickets |
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 random | |
import time | |
mode = "percentage" | |
shuffle = True | |
sampling_percentage = 20 | |
sampling_count = 1000 | |
start_data_gen = time.time() | |
data = [i for i in xrange(20000, 15000001)] # 20.000 - 15.000.000 |
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
with ones as ( | |
select base.n from (values (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)) base(n) | |
), tens as ( | |
select 10 * ones.n as n from ones | |
), hundreds as ( | |
select 100 * ones.n as n from ones | |
--), thousands as ( | |
-- select 1000 * ones.n as n from ones | |
), num_series as ( | |
select |
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 bs4 import BeautifulSoup # optional; be sure to install this & lxml if you're following this example | |
import requests | |
import sys | |
def create_rfc_1123_datetime(): | |
from wsgiref.handlers import format_date_time | |
from datetime import datetime | |
from time import mktime | |
now = datetime.now() |
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 flask import Flask, render_template, redirect, request, url_for, jsonify | |
from flask_sqlalchemy import SQLAlchemy | |
from sqlalchemy import text | |
app = Flask(__name__) | |
app.config["DEBUG"] = False | |
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False | |
""" |
NewerOlder