Skip to content

Instantly share code, notes, and snippets.

View Informatic's full-sized avatar
🤔
excuse me, is this facebook

Piotr Dobrowolski Informatic

🤔
excuse me, is this facebook
View GitHub Profile
@Informatic
Informatic / README.md
Last active November 30, 2018 00:02
Yi 2 Firmware reverse-engineering

Yes. It's real. These are just my notes after skimming through the firmware. (protip: update API)

Hardware revisions: 12L, 13L Internal version: z16 (it's all over the place)

Features

  • Running A9S, as everyone might've guessed
  • Seems to have EXFAT support in uITRON
  • SuperView
@Informatic
Informatic / network.nix
Created January 20, 2019 21:32
NixOS OVH IP Failover virtual machine configuration
{
# [...]
# Assuming failover IP being 1.2.3.4 and host primary IP being 5.6.7.8
networking.interfaces.ens3.ipv4.addresses = [ {
address = "1.2.3.4";
prefixLength = 32;
} ];
networking.interfaces.ens3.ipv4.routes = [ {
address = "5.6.7.254";
@Informatic
Informatic / janus.py
Last active March 24, 2019 08:34
Minimal janus-gateway REST API python client
# Reference:
# https://janus.conf.meetecho.com/docs/rest.html
# https://janus.conf.meetecho.com/docs/streaming.html
import requests
import json
import pprint
import random
import string
{ stdenv, fetchurl, patchelf, makeWrapper, xorg, gcc, gcc-unwrapped, freetype, fontconfig, liberation_ttf }:
stdenv.mkDerivation rec {
name = "IPMIView-${version}";
version = "2.16.0";
buildVersion = "190528";
src = fetchurl {
url = "https://www.supermicro.com/wftp/utility/IPMIView/Linux/IPMIView_${version}_build.${buildVersion}_bundleJRE_Linux_x64.tar.gz";
sha256 = "0pz4q8vsnv6wqpiy6am333c2cgsdjmxc6w9vm4hi8qyaavfbq0w2";
@Informatic
Informatic / tagify-cookbook
Created August 5, 2019 13:18
Quickly add git version tags for specified chef cookbook (could easily be adapted to any other piece of infrastructure, eg. npm package.json file, as long as one is able to extract unique version identifier on specified git ref)
#!/usr/bin/env bash
# Creates local version tags based on cookbook metadata.rb change history
# Usage: bash tagify-cookbook [cookbook_name]
cookbook=${1:-some_cookbook}
git log --pretty=format:"%h" cookbooks/$cookbook/metadata.rb | while read ref; do
tag="$cookbook-$(git show $ref:cookbooks/$cookbook/metadata.rb | grep "^version '" | sed -E "s/.* '(.*)'/\1/g" )"
echo "ref: $ref -> $tag";
@Informatic
Informatic / README.md
Last active October 4, 2020 07:01
Minimal Tor hidden service on OpenWRT
  1. Format your storage
  2. Configure networking (it's easiest with LuCI, or just take a look at OpenWRT howtos)
  3. Configure /storage by adding proper options in /etc/config/fstab, or, again, just clicking around in LuCI
  4. opkg update && opkg install tor
  5. Copy proper configuration, namely /etc/tor/torrc and /etc/config/uhttpd
  6. Reboot (or /etc/init.d/uhttpd restart && /etc/init.d/tor restart)
  7. Check /etc/tor/hidden_service/hostname for your public .onion address
  8. ...
  9. PROFIT!
@Informatic
Informatic / gziplogging.py
Last active October 23, 2020 10:24
python logging rotating gzipping handler
#
# A quick tip on how to set up rotating logging handler with
# automatic gzipping of rotated files. Tested on python 3.7
#
#
# Testing tip:
# python gziplogging.py
# touch example.log --date='2005/01/01'
# python gziplogging.py
# ls -lah *.log*
@Informatic
Informatic / JanusStream.vue
Last active November 12, 2020 09:25
Quick and dirty Janus WebRTC Gateway Streaming plugin component for Vue.js based on https://github.com/TechTeamer/janus-api
<template>
<video controls></video>
</template>
<script>
/* Note: you may need to add `externals: { ws: "WebSocket"},` to Your webpack configuration for this to work properly */
import { Janus, StreamingJanusPlugin } from '@techteamer/janus-api'
export default {
props: ['config', 'stream'],
@Informatic
Informatic / image.its
Last active August 4, 2021 07:45
Example FIT image descriptor & buildroot post-image hook / https://blog.inf.re/buildroot-cheatsheet.html
/dts-v1/;
/ {
description = "Example FIT image";
#address-cells = <1>;
images {
kernel@1 {
description = "default kernel";
data = /incbin/("./zImage");
networking.networkmanager = {
enable = true;
# Let's just use networkmanager for modem support for now
unmanaged = [ "wlan0" ];
};
systemd.services.NetworkManager.requires = [ "ModemManager.service" ];
systemd.services.ModemManager.requires = [ "rmtfs.service" ];