Skip to content

Instantly share code, notes, and snippets.

@hlev
hlev / gist:225f63274109cb75f144f9dfe1d59bb4
Created August 6, 2019 08:37
Pi benchmark throttling, measure temp and arm clock speed
nohup sysbench --num-threads=8 --test=cpu --cpu-max-prime=10000000000 run &
watch '(vcgencmd measure_temp; vcgencmd measure_clock arm)'
@hlev
hlev / shrink.md
Created June 28, 2019 00:38
Truncate complete disk image created with dd

https://superuser.com/questions/610819/how-to-resize-img-file-created-with-dd First make sure the free space is actually empty, and doesn't contain leftovers of deleted files. The easiest way to achieve this is to create a huge file on the disk, containing only null bytes, then delete it.

# losetup --find --partscan foo.img
# lsblk
NAME      MAJ:MIN RM    SIZE RO TYPE MOUNTPOINT
loop0       7:0    0   4096M  0 loop 
├─loop0p1 259:0    0   2048M  0 loop 
└─loop0p2 259:1 0 2048M 0 loop 
@hlev
hlev / toldotechnik.diff
Created November 13, 2018 23:51
Toldotechnik PoC - Build and run recent WPEWebkit buildroot with deprecated WPELauncher
diff --git a/configs/toldotechnik_rpi3_wpe_defconfig b/configs/toldotechnik_rpi3_wpe_defconfig
new file mode 100644
index 0000000000..aca9484334
--- /dev/null
+++ b/configs/toldotechnik_rpi3_wpe_defconfig
@@ -0,0 +1,81 @@
+BR2_arm=y
+BR2_cortex_a7=y
+BR2_ARM_FPU_NEON_VFPV4=y
+BR2_ARM_INSTRUCTIONS_THUMB2=y
@hlev
hlev / .diff
Last active November 5, 2018 10:59
wpebackend-rdk
# $ git diff stable master package/wpe/wpebackend-rdk/wpebackend-rdk.mk
# The stable branch still uses WPELauncher, the master branch uses WPEFramework
# They build wpebackend-rdk differently
diff --git a/package/wpe/wpebackend-rdk/wpebackend-rdk.mk b/package/wpe/wpebackend-rdk/wpebackend-rdk.mk
index 5469664227..95821db3fd 100644
--- a/package/wpe/wpebackend-rdk/wpebackend-rdk.mk
+++ b/package/wpe/wpebackend-rdk/wpebackend-rdk.mk
@@ -4,7 +4,7 @@
#
@hlev
hlev / i3confsnip
Last active December 10, 2018 11:53
i3 config snippets
# Custom app launcher
set $ides "IDEs [p]hpstorm [c]lion [i]ntellij"
bindsym $mod+i mode $ides
mode $ides {
bindsym p exec --no-startup-id "i3-msg 'workspace 2; exec /opt/jetbrains/phpstorm_latest/bin/phpstorm.sh; mode \\"default\\"'"
bindsym c exec --no-startup-id "i3-msg 'workspace 2; exec /opt/jetbrains/clion_latest/bin/clion.sh; mode \\"default\\"'"
bindsym i exec --no-startup-id "i3-msg 'workspace 2; exec /opt/jetbrains/intellij_latest/bin/idea.sh; mode \\"default\\"'"
bindsym Return mode "default"
bindsym Escape mode "default"
@hlev
hlev / 5perc.md
Last active January 29, 2018 07:33
3.3
@hlev
hlev / scan2pdf
Created November 24, 2017 12:29
Helper script to scan straight to PDF with network scanner on the LAN using scanimage and unoconv
#!/usr/bin/env bash
# usage: scan2pdf output
# results in: output.pdf
# possible improvements:
# - config file for IP, default resolution, sleep time
# - device discovery
# - platform-agnostic temp file usage
# - investigate parsing errors of otherwise successful conversions
tmpfile=$(mktemp /tmp/scan.XXXX);
@hlev
hlev / h264_1080p_to_720p_ffmpeg.md
Last active May 31, 2021 04:26
Transcoding and scaling native h264 portrait video with ffmpeg

Original

https://vimeo.com/166500954

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vertical.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41isomavc1
    creation_time   : 2016-05-20 00:41:40
@hlev
hlev / mapgen.md
Last active October 7, 2017 12:29
XCSoar mapgen usage example

As of 2017-10-06: If the XCSoar Map Generator site does not work or you want to use the Map Generator in your own project, you can do so as described here. You don't need to know any programming language if you only want to generate maps for XCSoar.

Windows

Disclaimer: I'm writing this up based on my assumptions, have not tried Windows, so YMMV. (!) Read the comment first!

All the required tools and dependencies are available on Windows

@hlev
hlev / gist:cd27324aa53c4143d565a1cac50bbf3a
Created October 12, 2016 15:30 — forked from SzymonPobiega/gist:5220595
DDD/CQRS/ES/Architecture videos

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht