Skip to content

Instantly share code, notes, and snippets.

View Fak3's full-sized avatar

Evstifeev Roman Fak3

View GitHub Profile
{
"@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 October 23, 2020 11:58
missing org.freedesktop.portal.Request Interface in the portal introspection
$ 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"/>
{
"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 January 14, 2020 17:22
Example JSON-LD Context common for all edi3.org requests/responses
{
"@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 17:26 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

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
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 March 24, 2019 08:18
/proc/vmstat after almost hanging
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
@Fak3
Fak3 / ramhog.py
Created December 31, 2018 17:53
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])
#!/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('Улица'):
@Fak3
Fak3 / parse_okruga.py
Created August 24, 2016 19:53
okruga-spb
#!/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())