Skip to content

Instantly share code, notes, and snippets.

View context.json
{
"@context": {
"@version": 1.1,
"@protected": true,
"OpenAttestationCredential": {
"@id": "https://schemata.openattestation.com/vocab/#OpenAttestationCredential",
"@context": {
"identity": {
"@id": "https://lol.com/todo",
"@context": {
@Fak3
Fak3 / gist:0f2c262d09d00bbdd348d7cd6635a3fa
Created Oct 23, 2020
missing org.freedesktop.portal.Request Interface in the portal introspection
View gist:0f2c262d09d00bbdd348d7cd6635a3fa
$ dbus-send --session --dest=org.freedesktop.portal.Desktop --type=method_call --print-reply /org/freedesktop/portal/desktop org.freedesktop.DBus.Introspectable.Introspect
method return time=1603453688.987341 sender=:1.124 -> destination=:1.616 serial=386 reply_serial=2
string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!-- GDBus 2.64.3 -->
<node>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg type="s" name="interface_name" direction="in"/>
View res.json
{
"1": {
"camera_1": "571b69fb-d915-4494-b828-fc21d30b6fff",
"camera_2": "5e6f57d2-1465-4793-a1a5-78d70fd0ff68",
"camera_3": "533b3931-9a4d-49a3-8aae-61949ba32767",
"camera_4": "4e9789fa-619f-472c-a752-dd67aaa8b8af",
"camera_5": "8bdaf3ba-eb02-4e6f-8759-80f033d17417"
},
"2": {
"camera_6": "cb29ef26-e52c-4e61-aa7a-e32816a8d01e",
@Fak3
Fak3 / context.json
Last active Jan 14, 2020
Example JSON-LD Context common for all edi3.org requests/responses
View context.json
{
"@context": {
"dc": "http://purl.org/dc/terms/",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"@version": 1.1,
"@vocab": "http://edi3.org/vocab/",
"type": {
"@id": "@type",
"@type": "@vocab"
},
@Fak3
Fak3 / m3u8-to-mp4.md
Created May 27, 2019 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg
View m3u8-to-mp4.md

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
View logutils.py
def streamdup(stream, filename, mode='a+'):
"""
Aka "tee".
Duplicate stream output to the file with given name.
Usage:
>>> streamcopy(sys.stderr, 'myfile', 'a+')
"""
stream._tee = open(filename, mode)
@Fak3
Fak3 / gist:c4c7e2e036ba102dac337b193ee28820
Created Mar 24, 2019
/proc/vmstat after almost hanging
View gist:c4c7e2e036ba102dac337b193ee28820
nr_free_pages 1936576
nr_zone_inactive_anon 38027
nr_zone_active_anon 671492
nr_zone_inactive_file 151489
nr_zone_active_file 69616
nr_zone_unevictable 8
nr_zone_write_pending 5758
nr_mlock 8
nr_page_table_pages 6801
nr_kernel_stack 10144
View ramhog.py
from time import sleep
print('Press ctrl-c to exit; Press enter to hog 100MB more')
one = b'Z' * 1024 * 1024 # 1MB
hog = []
while True:
hog.append(one * 100) # allocate 100MB
free = '; '.join(open('/proc/meminfo').read().split('\n')[1:3])
View parse_216.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from pandas import read_csv
csv = read_csv('doma_uik_okruga.csv')
for raion, rdata in csv[csv['округ Дума']==216].groupby(['Район']):
print('\n РАЙОН', raion)
for ulica, udata in rdata.groupby('Улица'):
View parse_okruga.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from pandas import read_csv
csv = read_csv('doma_uik_okruga.csv')
with open('uiks_by_duma.json', 'w+') as file:
file.write(csv.groupby('округ Дума')['УИК'].unique().to_json())