Skip to content

Instantly share code, notes, and snippets.

@hhromic
hhromic / raspbian-stretch-lite-slimdown.md
Last active May 22, 2023 11:02
Slimming Down Raspbian Stretch Lite

Slimming Down Raspbian Stretch Lite

Notes for slimming down a fresh installation of Raspbian Stretch Lite. This guide does not strip Raspbian of basic functionality such as Bluetooth and mDNS.

Instructions

Install a fresh Raspbian Stretch Lite image into the SD card ([source][1]).

$ unzip -p 2018-04-18-raspbian-stretch-lite.zip | dd bs=4M of=/dev/sdX conv=fsync

@hhromic
hhromic / tradfri.sh
Last active April 16, 2023 21:06
Show information about IKEA Tradfri devices firmware from the official IKEA servers in Linux
#!/usr/bin/env bash
# Show information about IKEA Tradfri devices firmware from the official IKEA servers
# script by github.com/hhromic
# optional filter
declare -r FILTER=$1
# URLs for firmware channels
declare -r -A CHANNEL_URLS=(
[CURRENT]=http://fw.ota.homesmart.ikea.net/feed/version_info.json
@hhromic
hhromic / wpe-yocto.md
Last active January 28, 2023 13:53
Building WPE with Yocto for Raspberry Pi Zero W

Repositories Cloning

BRANCH=master  # or 'rocko'
xargs -n 1 git clone -b $BRANCH <<'__EOF__'
git://git.yoctoproject.org/poky
git://git.openembedded.org/meta-openembedded
git://github.com/agherzan/meta-raspberrypi
git://github.com/webplatformforembedded/meta-wpe
__EOF__
@hhromic
hhromic / python-time.md
Last active January 15, 2021 10:41
Time Data Manipulations in Python

Cheat Sheet for Python Time Data

Note: These snippets are tested with Python 3, which has better datetime object support than Python 2.

Textual Time to datetime Object

from datetime import datetime

# example Twitter "created_at" field time format
@hhromic
hhromic / pitft28.md
Last active June 15, 2020 13:53
Adafruit PiTFT 2.8" Setup

Adafruit PiTFT 2.8" Setup

Last tested on: Raspbian Buster

Setup Display and HDMI

Add the following snippet to /boot/config.txt:

# Adafruit PiTFT 2.8"

dtoverlay=pitft28-resistive,speed=64000000,fps=30

@hhromic
hhromic / latex-tips.md
Last active January 3, 2019 18:32
Useful LaTeX snippets

Useful LaTeX Snippets

About Lenghts

From https://tex.stackexchange.com/a/16956:

\textwidth is generally the global width of the text area, while \columnwidth is the width of a column of text (it will be different from \textwidth when typesetting in two or more columns). However, inside a minipage, \textwidth will be set to the given argument along with \hsize, \columnwidth, and \linewidth (they will revert to the previous values at the end of the minipage because it forms a group). Note that \parbox doesn't reset \textwidth; the size is available as \linewidth.

The parameter \linewidth contains the line length inside a list (or derived) environment and it may change in a nested list (while \hsize, \textwidth and \columnwidth don't change). >

@hhromic
hhromic / gitmirror.sh
Created November 15, 2018 10:40
Mirror a git repository into another in Linux
#!/usr/bin/env bash
# Mirror a git repository into another
# script by github.com/hhromic
# origin git repository
declare -r ORIGIN="<<your origin git repository here>>"
# destination git repository (mirror)
declare -r MIRROR="<<your destination (mirror) git repository here>>"
@hhromic
hhromic / disk-images.md
Last active November 5, 2018 18:28
Working with disk images in Linux
@hhromic
hhromic / pypi.md
Last active October 25, 2018 12:48
Publishing to PyPi

Publishing to PyPi

  1. Update code
  2. Update version number in setup.py or setup.cfg
  3. Commit all changes: git commit -a
  4. Tag the current state with version number: git tag X.Y.Z
  5. Push changes to remote: git push --tags
  6. Build source distribution: python setup.py sdist bdist_wheel
  7. Release to PyPi: twine upload dist/*
  8. Update GitHub release with notes and other stuff
@hhromic
hhromic / battery.sh
Created October 6, 2018 15:54
Show the current capacity of all managed batteries in Linux
#!/usr/bin/env bash
# Show the current capacity of all managed batteries
# script by github.com/hhromic
POWER_SUPPLY_DIR=/sys/class/power_supply
mapfile -t CAPACITIES < <(compgen -G "$POWER_SUPPLY_DIR"/'*'/capacity)
for capacity in "${CAPACITIES[@]}"; do
battery="${capacity%/*}"
battery="${battery##*/}"