Skip to content

Instantly share code, notes, and snippets.

View analytik's full-sized avatar
😐
b u r n o u t

Milan B analytik

😐
b u r n o u t
View GitHub Profile
@analytik
analytik / Speed Editor 1edb da0e.txt
Created October 29, 2025 07:55
Speed Editor USB description 1edb:da0e
DeviceDescriptor {
bLength: 18,
bDescriptorType: 1,
bcdUSB: 512,
bDeviceClass: 239,
bDeviceSubClass: 2,
bDeviceProtocol: 1,
bMaxPacketSize: 64,
idVendor: 7899,
idProduct: 55822,
@analytik
analytik / tic_tac_toe_no_deps_rust.rs
Last active May 31, 2025 05:45
Tic Tac Toe in console in Rust with no dependencies
use std::{fmt, io};
use std::fmt::{Display, Formatter};
use std::time::SystemTime;
const SPACER: &str = " ";
impl Display for Field {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
let result: char = match self {
Field::Empty => ' ',
@analytik
analytik / get_kafka_size.py
Last active September 8, 2021 07:15 — forked from turtlemonvh/get_kafka_size.py
Get the size of kafka topics on disk, order by largest first
#!/usr/bin/python
import os
from collections import defaultdict
import subprocess
kafka_log_dir = "/var/lib/kafka/data/"
size_unit = pow(1024.0, 2) # mbs
@analytik
analytik / istio_ip_whitelist.sh
Created February 25, 2020 08:22
How to create an IP whitelist for Istio
# Whitelist office IP's only
kubectl -n istio-system patch svc istio-ingressgateway -p '{"spec":{"externalTrafficPolicy": "Local"}}'
ingressgatewaypod=$(kubectl -n istio-system get pods -l app=istio-ingressgateway -o name | cut -d / -f 2)
kubectl -n istio-system delete pod $ingressgatewaypod
# If this rule needs changing then delete previous isntances beforehand, otherwise it does not seem to be picked up
# kubectl -n istio-system delete handler whitelistip
# kubectl -n istio-system delete instance sourceip
# kubectl -n istio-system delete rule checkip
kubectl apply -f - <<EOF
apiVersion: config.istio.io/v1alpha2
@analytik
analytik / console.js
Created July 2, 2018 13:33
Slow down or speed up youtube video playback
document.getElementsByTagName('video')[0].playbackRate = 1.1
@analytik
analytik / snippets.sql
Created June 7, 2018 08:12
A collection of PostgreSQL queries and reminders
-- See here for an explanation on when is restart or reload needed:
-- https://blog.dbi-services.com/which-parameter-changes-do-require-a-restart-of-my-postgresql-instance/
show random_page_cost ;
-- this will make reads better on SSDs and really should be the default:
alter system set random_page_cost=1;
select * from pg_reload_conf();
show random_page_cost ;
@analytik
analytik / [email protected] build log
Created March 16, 2018 07:43
node-rdkafka build 2.2.3/2.3.1 with debian 9.4 and node.js 9.8
> [email protected] preinstall /usr/lib/node_modules/node-rdkafka
> node util/configure
checking for OS or distribution... ok (Linux)
checking for C compiler from CC env... failed
checking for gcc (by command)... ok
checking for C++ compiler from CXX env... failed
checking for C++ compiler (g++)... ok
checking executable ld... ok
checking executable nm... ok
@analytik
analytik / 2018-01-11T13_55_20_300Z-debug.log
Created January 11, 2018 14:06
node-rdkafka 2.2.1-master npm install log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'i',
1 verbose cli 'git+https://[email protected]/Blizzard/node-rdkafka.git' ]
2 info using [email protected]
3 info using [email protected]
4 silly install loadCurrentTree
5 silly install readLocalPackageData
6 silly fetchPackageMetaData git+https://[email protected]/Blizzard/node-rdkafka.git
@analytik
analytik / npm-install-461.sh
Created December 21, 2017 12:24
npm-install.sh script with hardcoded version 4.6.1
#!/bin/sh
# A word about this shell script:
#
# It must work everywhere, including on systems that lack
# a /bin/bash, map 'sh' to ksh, ksh97, bash, ash, or zsh,
# and potentially have either a posix shell or bourne
# shell living at /bin/sh.
#
# See this helpful document on writing portable shell scripts:
@analytik
analytik / Dockerfile
Created July 26, 2017 06:45
Basic RethinkDB - official-build based docker image
FROM debian:jessie
ENV LC_ALL C.UTF-8
RUN apt-get update && apt-get install -y vim nano curl netcat less tcpdump
# Add the RethinkDB repository and public key
ENV RETHINKDB_PACKAGE_VERSION 2.3.6~0jessie
RUN curl -s https://download.rethinkdb.com/apt/pubkey.gpg | apt-key add -v - \
&& echo "deb http://download.rethinkdb.com/apt jessie main" > /etc/apt/sources.list.d/rethinkdb.list \