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
import sqlite3 | |
import itertools | |
names = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', | |
'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', | |
'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty'] | |
groups = itertools.cycle([1, 2, 3]) | |
ids = itertools.count(1) | |
data = zip(ids, names, groups) |
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
{"reqId":"JI1FPhUSoqVsxFQx1nbx","level":3,"time":"2020-01-14T14:15:39+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"Error while sending QUERY packet. PID=24296 at \/snap\/nextcloud\/18204\/htdocs\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOStatement.php#141","userAgent":"--","version":"16.0.7.1"} | |
{"reqId":"um6sul7SgptfXnVXCr7b","level":4,"time":"2020-01-14T15:51:37+00:00","remoteAddr":"127.0.0.1","user":"jbiason","app":"webdav","method":"PROPFIND","url":"\/remote.php\/dav\/files\/jbiason\/External","message":{"Exception":"Doctrine\\DBAL\\Exception\\LockWaitTimeoutException","Message":"An exception occurred while executing 'UPDATE `oc_filecache` SET `mtime` = ?, `etag` = ?, `storage_mtime` = ?, `checksum`=? WHERE (`mtime` <> ? OR `etag` <> ? OR `storage_mtime` <> ? OR `checksum` <> ? OR `mtime` IS NULL OR `etag` IS NULL OR `storage_mtime` IS NULL OR `checksum` IS NULL) AND `fileid` = ? ' with params [1579007046, \"5e1de356b3af0\", 1579007046, \"\", 1579007046, |
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
class Base: | |
version = "unknown" | |
code = "unknown" | |
@classmethod | |
def identifier(cls): | |
return cls.code + '/' + cls.version | |
def do(self): | |
print("I'm a stupid method in the base class") |
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
abstract class BaseClass { | |
public static String getVersion() { | |
return "Unknown"; | |
} | |
public static String getGroup() { | |
return "Unknown"; | |
} | |
public static String getIdentifier() { |
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
abstract class Metric { | |
def parse(line:String):List[String] | |
} | |
class MetricData extends Metric { | |
def parse(line:String):List[String] = { | |
println("MetricData") | |
List() | |
} | |
} |
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
#!/bin/bash | |
ffmpeg -y -i $1 -vf fps=10,scale=320:-1:flags=lanczos,palettegen palette.png | |
ffmpeg -i $1 -i palette.png -filter_complex "fps=10,scale=-1:-1:flags=lanczos[x];[x][1:v]paletteuse" -- $1.gif |
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
SAFE_ENCODE_URL_CHARACTERS = ['/', '*'] | |
import urlparse | |
import urllib | |
def encode(url): | |
if not url.startswith(('//', 'http', 'ftp')): | |
url = '//' + url | |
frags = list(urlparse.urlparse(url)) |
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 __future__ import print_function | |
import random | |
import argparse | |
CONSONANTS = ['f', 'j', 'c', 'l', 'n'] | |
PASSPHRASE = '{}u{}am para as {}o{}i{}as' | |
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
# This is the "mockator": | |
def _mock_requests_method(responses, url, *dummy1, **dummy2): | |
"""Check the URL and return the expected response.""" | |
if url not in responses: | |
raise AssertionError('URL doesnt exist: {}', url) | |
(status, text) = responses[url] | |
response = Response() | |
response.status_code = status | |
response.raw = StringIO.StringIO(text) | |
return response |
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
reorder = lambda eq: '+'.join(sorted(eq.split('+'), key=int)) | |
# (’3+2+1+1’), ’1+1+2+3’ | |
# (’1+2+3’), ’1+2+3’ | |
# (’2+2’), ’2+2’ | |
# (’1+3+2+3+2+1+3+2+3+1+2’), ’1+1+1+2+2+2+2+3+3+3+3’ |
NewerOlder