Skip to content

Instantly share code, notes, and snippets.

View player.html
<html>
<head>
</head>
<body>
<video width="960" height="540" controls>
<source src="" type="video/mp4">
</video>
<script type="application/javascript">
View running_queries.sql
with running_queries as (
select
pid,
datname as database_name,
(case when state='active' then now() else state_change end) - query_start as run_time,
backend_start,
xact_start,
query_start,
state_change,
wait_event_type,
View setting.json
"registry-mirrors": [
"http://saturn.lan.whitehorn.us:5000"
]
View script.sh
docker pull registry
docker run -d -p 5000:5000 \
--restart always \
-e REGISTRY_PROXY_REMOTEURL='https://registry-1.docker.io' \
-v /mnt/simple-storage/registry:/var/lib/registry \
--name registry registry
We couldn’t find that file to show.
View gist:a9ab315b7c01160b30d2d6441bbd9db1
~> python --help
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Options and arguments (and corresponding environment variables):
...
-u : force the binary I/O layers of stdout and stderr to be unbuffered;
stdin is always buffered; text I/O layer will be line-buffered;
also PYTHONUNBUFFERED=x
View Dockerfile
FROM python:3.7.4
RUN mkdir -p /var/app
WORKDIR /var/app
COPY . ./
CMD python -u app.py
View Dockerfile
FROM python:3.7.4
RUN mkdir -p /var/app
WORKDIR /var/app
COPY . ./
CMD python app.py
View app.py
import time
print("App running!")
while True:
time.sleep(5)
View Sync.m
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setHTTPMethod:@"GET"];
NSString *url = @"http://localhost:5000/api/updates/";
if(checksum){
url = [NSString stringWithFormat:@"%@?checksum=%@", url, checksum];
}
[request setURL:[NSURL URLWithString:url]];
[[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *err) {
NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode];