Skip to content

Instantly share code, notes, and snippets.

@rudyryk
rudyryk / config.py
Last active June 12, 2023 16:51
Jupyter Lab configuration
# Configuration file for lab.
c = get_config() #noqa
#------------------------------------------------------------------------------
# Application(SingletonConfigurable) configuration
#------------------------------------------------------------------------------
## This is an application.
## The date format used by logging formatters for %(asctime)s
@rudyryk
rudyryk / dump-postgres.sh
Last active May 12, 2023 09:12
Dump PostgresQL database via Docker
#!/bin/sh
export DBUSER=postgres
export DBNAME=database
export DBHOST=localhost
export DBPORT=5432
export DBOPTIONS=
export PGPASSWORD=
docker run --rm -e PGPASSWORD=${PGPASSWORD} postgres:latest pg_dump ${DBOPTIONS} \
@rudyryk
rudyryk / settings.json
Created March 13, 2023 20:28
Minimal .vscode/settings.json for Python project
{
"python.defaultInterpreterPath": "./.venv/bin/python",
"python.linting.enabled": true,
"[python]": {
"editor.insertSpaces": true,
"editor.tabSize": 4
},
"files.exclude": {
".ruff_cache": true,
".pytest_cache": true,
@rudyryk
rudyryk / time_base_uuid.py
Created November 10, 2022 02:57
Simple time-prefixed UUID in Python
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES
# OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# No Rights Reserved
@rudyryk
rudyryk / docker-compose.yml
Created April 7, 2022 20:24
Minimalistic RTMP server configuration
version: '3'
services:
nginx:
image: tiangolo/nginx-rtmp:latest
restart: unless-stopped
ports:
- 21935:1935
@rudyryk
rudyryk / InteractiveClient.spheroid
Created November 9, 2021 12:56
SpheroidScript interactive example with button and label
var counter = 0
var counterText = null
fun main() {
println("Hello from InteractiveClient")
MainMenu {
Container(top = 60dp, right = 20dp, bottom=60dp, left = 20dp) {
Vertical(spacing = 0, left = 0, right = 0, verticalAlign = "center") {
Container(
@rudyryk
rudyryk / gopro_get_time.py
Created April 16, 2020 21:31
Get date & time on GoPro camera via unofficial API
# https://github.com/KonradIT/gopro-py-api
import json
import datetime
from goprocam import GoProCamera, constants
goproCamera = GoProCamera.GoPro()
status = json.loads(goproCamera.getStatusRaw()).get('status')
status_time = status.get('40', [])[1:].split('%')
time_parts = [int(item, 16) for item in status_time]
if time_parts:
time_parts[0] += 2000
"""Simple server to host static files for development.
Installation:
python3 -m venv ~/.virtualenvs/simple
source ~/.virtualenvs/simple/bin/activate
pip install cherrypy
python server.py
Snippet source:
@rudyryk
rudyryk / Default.sublime-theme
Created June 8, 2018 14:40
Larger fonts in Sublime Text 3
[
{
"class": "sidebar_label",
"font.bold": false,
"font.size": 16
},
{
"class": "tab_label",
"font.bold": false,
"font.size": 14
@rudyryk
rudyryk / MyPageRenderer.cs
Last active March 13, 2017 14:06
Xamarin.Forms / C# — Custom modal page transition for iOS via setting the ModalTransitionStyle property
// MyPageRenderer.cs
//
// No Rights Reserved
// http://creativecommons.org/publicdomain/zero/1.0/
//
// Define custom Xamarin.Forms renderer for iOS platform
// for page you want to show as modal. View controller
// for the page is wrapped into internal Xamarin.Forms
// wrapper class and we can access it as parent.
//