Skip to content

Instantly share code, notes, and snippets.

@rudyryk
rudyryk / Badge.cs
Last active November 9, 2023 08:57
C# — Xamarin.Forms custom simple badge view + rounded box view via custom renderer
//
// Badge.cs
// Created by Alexey Kinev on 19 Jan 2015.
//
// Licensed under The MIT License (MIT)
// http://opensource.org/licenses/MIT
//
// Copyright (c) 2015 Alexey Kinev <alexey.rudy@gmail.com>
//
using System;
@rudyryk
rudyryk / ImageMeter.cs
Last active October 6, 2023 11:32
C# — Get image size by name in Xamarin.Forms for iOS and Android platforms
//
// ImageMeter.cs
// Created by Alexey Kinev on 9 May 2015.
//
// No Rights Reserved
// http://creativecommons.org/publicdomain/zero/1.0/
//
// Get image size by name in Xamarin.Forms for iOS and Android platforms.
//
using System;
@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 / post-receive
Last active May 23, 2022 16:00
Git post-receive hook sample for basic Django project
#!/usr/bin/env python
#
# No Rights Reserved
# http://creativecommons.org/publicdomain/zero/1.0/
"""Git post-receive hook script
Suggested project structure::
/home/$_USER/
env/
@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 / TextMeter.cs
Last active August 8, 2021 10:53
C# — Measure string size in Xamarin.Forms for iOS and Android platforms
//
// TextMeter.cs
// Created by Alexey Kinev on 11 Feb 2015.
//
// Licensed under The MIT License (MIT)
// http://opensource.org/licenses/MIT
//
// Copyright (c) 2015 Alexey Kinev <alexey.rudy@gmail.com>
//
// Usage example: