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 argparse | |
import yadisk # https://pypi.org/project/yadisk/ | |
def check_auth(y): | |
if y.check_token(): | |
print("Token valid") | |
else: | |
raise Exception('Token invalid!') |
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
cd /var | |
find . -type d | | |
while | |
read line | |
do | |
echo "$( find "$line" -maxdepth 1 | wc -l) $line" | |
done | | |
sort -rn | less |
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
<?php | |
function is_https() { | |
// dont use `filter_input(INPUT_SERVER, '...')`: | |
// https://github.com/xwp/stream/issues/254 | |
$https = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : ''; | |
if (!empty($https)) { | |
$https = strtolower($https); | |
if ($https == 'on') { | |
return true; |
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
#! /usr/bin/env python | |
""" | |
Original: https://gist.github.com/mikeyk/1329319 | |
https://instagram-engineering.com/storing-hundreds-of-millions-of-simple-key-value-pairs-in-redis-1091ae80f74c | |
➜ time python benchmarks/redis_hset_set.py normal | |
Set: 79.34 sec | |
Size: 92.6 MB | |
Get: 73.74 sec |
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
""" | |
$ pip install flask sqlalchemy psycopg2-binary | |
$ FLASK_ENV=development FLASK_APP=app.py flask run | |
""" | |
import random | |
from flask import Flask, abort, request, views | |
from sqlalchemy import Column, MetaData, String, Table, create_engine, select | |
from string import ascii_letters | |
from typing import Optional |
OlderNewer