Skip to content

Instantly share code, notes, and snippets.

View tomasbedrich's full-sized avatar

Tomáš Bedřich tomasbedrich

  • BB Control
  • Pilsen, Czech Republic
  • 22:49 (UTC +02:00)
View GitHub Profile
@tomasbedrich
tomasbedrich / flash.sh
Last active October 5, 2022 11:58
Tasmota to Mongoose OS (Shelly)
# the device must be connected to the internet
DEVICE=192.168.77.106
# pick the right FW_URL! see: https://github.com/yaourdt/tasmota-to-mgos#install
INTERMEDIATE_FW_URL=https://dl.dasker.eu/firmware/mgos512k-0x7000.bin
TARGET_FW=http://firmware.shelly.cloud/gen1/SHBDUO-1.zip
# download target firmware
curl -o fw.zip "$TARGET_FW"

Keybase proof

I hereby claim:

  • I am tomasbedrich on github.
  • I am tomasbedrich (https://keybase.io/tomasbedrich) on keybase.
  • I have a public key ASAWK5BwewGV2cKlNJe0WYLPaXpyMZSdpwV0aMN0oH25zgo

To claim this, I am signing this object:

@tomasbedrich
tomasbedrich / sentry-get-all-events.py
Created September 24, 2019 09:37
Download all events from Sentry project to JSON files
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import requests
import json
import time
@tomasbedrich
tomasbedrich / README.md
Last active September 3, 2019 10:55
MongoDB Docker JSON analysis

Create temporary MongoDB Docker container (named some-mongo) and fill it with JSON data from data subdir in current working directory. The documents are placed in tmp DB, tmp collection.

@tomasbedrich
tomasbedrich / render-header.php
Last active August 29, 2016 18:37
Render single Nette component
<?php
$container = require __DIR__ . '/../app/bootstrap.php';
$app = $container->getByType('Nette\Application\Application');
$p = $app->getPresenterFactory()->createPresenter('Base');
$p->run($app->createInitialRequest());
$p['header']->render();
#!/usr/bin/env python3
from matplotlib import pyplot as plt
from matplotlib import animation
import threading
import collections
import queue
import logging
@tomasbedrich
tomasbedrich / pub.py
Created February 17, 2016 19:24
ZMQ demo
#!/usr/bin/env python3
import zmq
import struct
import sys
from time import sleep
def publish(port):
address = "tcp://*:{}".format(port)
@tomasbedrich
tomasbedrich / level0.py
Last active November 11, 2015 19:01
Web scraping in Python
#!/usr/bin/env python3
import sys
from requests import get
CRIME_CODE = 821 # = bribery
# make HTTP GET request for areas, parse them as JSON and access a list under a key "areas"
areas = get("http://mapakriminality.cz/api/areas", params={"level": 2}).json()["areas"]
@tomasbedrich
tomasbedrich / rotate.py
Created June 16, 2015 19:24
Example usage of linear transformation to draw and rotate 3D vectors
#!/usr/bin/env python3
from tkinter import Tk, Canvas, mainloop
from math import cos, sin, pi, sqrt
from numpy import dot
# dot = lambda X, Y: [[sum(a*b for a, b in zip(X_row, Y_col)) for Y_col in zip(*Y)] for X_row in X]
master = Tk()
#!/usr/bin/env python3
import requests
from bs4 import BeautifulSoup
from collections import namedtuple
from datetime import datetime
import csv
Earthquake = namedtuple('Earthquake', 'date, state, area, magnitude, lat, lon')