Skip to content

Instantly share code, notes, and snippets.

@gordinmitya
gordinmitya / .wezterm.lua
Created June 19, 2022 08:22
github.com/wez/wezterm config
-- ~/.wezterm.lua
local wezterm = require 'wezterm';
return {
keys = {
{key="w", mods="CMD", action=wezterm.action{CloseCurrentPane={confirm=true}}},
{key="d", mods="CMD", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}},
{key="d", mods="CMD|SHIFT", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
},
window_decorations = "RESIZE",
@gordinmitya
gordinmitya / CameraActivity.kt
Created December 2, 2020 22:10
android/camera-samples measurements for YUV conversion
/*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@gordinmitya
gordinmitya / config
Last active June 22, 2023 14:43
Fix terminator tab size
# ~/.config/terminator/config
[global_config]
scroll_tabbar = True
[keybindings]
switch_to_tab_1 = <Alt>1
switch_to_tab_2 = <Alt>2
switch_to_tab_3 = <Alt>3
switch_to_tab_4 = <Alt>4
switch_to_tab_5 = <Alt>5
@gordinmitya
gordinmitya / factorio_headless_guide.md
Created November 22, 2020 12:53 — forked from othyn/factorio_headless_guide.md
How to setup a Factorio Headless Server

[LINUX] Factorio Headless Server Guide

So, with credit to the Factorio wiki and cbednarski's helpful gist, I managed to eventually setup a Factorio headless server. Although, I thought the process could be nailed down/simplified to be a bit more 'tutorialised' and also to document how I got it all working for my future records.

The specific distro/version I'm using for this guide being Ubuntu Server 16.04.1 LTS. Although, that shouldn't matter, as long as your distro supports systemd (just for this guide, not a Factorio headless requirement, although most distros use it as standard now). The version of Factorio I shall be using is 0.14.20, although should work for any version of Factorio 0.14.12 and higher.

Alternate

If you prefer a simple, automated setup, [Bisa has a really handy init script that will do most of the work for

@gordinmitya
gordinmitya / rgb2ycbcr.py
Created October 26, 2020 11:09
rgb, ycbcr, opencv, numpy, skimage
import numpy as np
import cv2
import skimage.color
import torch
rgb2ycbcr = np.array([[65.481, 128.553, 24.966],
[-37.797, -74.203, 112.0],
[112.0, -93.786, -18.214]]).T
# from scipy import linalg
@gordinmitya
gordinmitya / MovingAvg.java
Created July 15, 2020 19:32
Moving average for performance measurements in Java
public class MovingAvg {
public final long[] measurements;
public final int size;
private int pointer = 0;
public MovingAvg(int size) {
measurements = new long[size];
this.size = size;
}
@gordinmitya
gordinmitya / Dockerfile
Created June 9, 2020 09:54
Mediapipe and Tensorflow Android NDK build environment
FROM ubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
wget \
@gordinmitya
gordinmitya / LogCat.txt
Last active June 3, 2020 09:05
Try to stop a Thread in Android
2020-06-03 11:48:51.762 31766-31766/? I/e.myapplicatio: Late-enabling -Xcheck:jni
2020-06-03 11:48:51.788 31766-31766/? E/e.myapplicatio: Unknown bits set in runtime_flags: 0x8000
2020-06-03 11:48:51.961 31766-31766/com.example.myapplication I/Perf: Connecting to perf service.
2020-06-03 11:48:51.976 31766-31766/com.example.myapplication I/FeatureParser: can't find raphael.xml in assets/device_features/,it may be in /system/etc/device_features
2020-06-03 11:48:51.983 31766-31766/com.example.myapplication E/libc: Access denied finding property "ro.vendor.df.effect.conflict"
2020-06-03 11:48:51.969 31766-31766/com.example.myapplication W/e.myapplication: type=1400 audit(0.0:750211): avc: denied { read } for name="u:object_r:vendor_displayfeature_prop:s0" dev="tmpfs" ino=16677 scontext=u:r:untrusted_app:s0:c215,c257,c512,c768 tcontext=u:object_r:vendor_displayfeature_prop:s0 tclass=file permissive=0
2020-06-03 11:48:51.995 31766-31823/com.example.myapplication E/Perf: Fail to get file list com.example.myapplicat
@gordinmitya
gordinmitya / LogCat.txt
Last active June 3, 2020 08:59
Try to stop a Thread in Android
....................
2020-06-03 11:35:10.481 31097-31137/com.example.myapplication D/STOPME: tik-tok
2020-06-03 11:35:12.661 31097-31137/com.example.myapplication I/chatty: uid=10471(com.example.myapplication) pool-1-thread-1 identical 9828 lines
2020-06-03 11:35:12.661 31097-31137/com.example.myapplication D/STOPME: tik-tok
2020-06-03 11:35:12.661 31097-31137/com.example.myapplication D/STOPME: tik-tok
2020-06-03 11:35:13.589 31097-31137/com.example.myapplication I/chatty: uid=10471(com.example.myapplication) pool-1-thread-1 identical 4247 lines
2020-06-03 11:35:13.589 31097-31137/com.example.myapplication D/STOPME: tik-tok
2020-06-03 11:35:13.590 31097-31097/com.example.myapplication D/STOPME: got exception
java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:206)
@gordinmitya
gordinmitya / Ford.java
Created April 28, 2020 20:05
Ford Fulkerson algorithm
import java.util.ArrayDeque;
import java.util.Queue;
public class Ford {
private static boolean bfs(int[][] residual, int s, int t, int[] path) {
Queue<Integer> queue = new ArrayDeque<>();
boolean[] visited = new boolean[residual.length];
queue.add(s);
visited[s] = true;