Skip to content

Instantly share code, notes, and snippets.

The following commands allow to enable screen mirroring to the first device using adb:

Run the following commands in an adb shell

am start -a android.settings.CAST_SETTINGS
input keyevent 19                                                                                                                                                                                                                    
input keyevent 23
if [ $(readlink /run/current-system/kernel) = $(readlink /run/booted-system/kernel) ]; then echo "no"; else echo "yes"; fi
@bachp
bachp / bitbake-cmake.sh
Created October 15, 2018 08:37
Build all cmake dependent Bitbake recipes
TARGETS=$(bitbake-layers show-recipes -i cmake | grep ":$" | sed 's/:$//')
bitbake -k ${TARGETS}
@bachp
bachp / print-hashes.py
Last active October 9, 2017 16:52
Fetch hashes for rust
#!/usr/bin/env python3
# Copyright (c) 2017 Pascal Bach
# SPDX-License-Identifier: MIT
# All rust-related downloads can be found at
# https://static.rust-lang.org/dist/index.html. To find the date on
# which a particular thing was last updated, look for the *-date.txt
# file, e.g.
# https://static.rust-lang.org/dist/channel-rust-beta-date.txt
@bachp
bachp / rdiff-backup-exporter.py
Last active September 27, 2017 17:57
Export rdiff-backup statistics to prometheus
#!/usr/bin/env python3
import glob
import os
import sys
# Select file
base = sys.argv[1]
backup = sys.argv[2]
files = glob.glob(os.path.join(base,"rdiff-backup-data/session_statistics.*.data"))
@bachp
bachp / gist:76680d8f1eae76a83016ba47cd50a4c0
Last active August 25, 2017 11:49
load-balancer-mod.nix
let
backend =
{ config, pkgs, comment ... }:
{ services.httpd.enable = true;
services.httpd.adminAddr = "[email protected]";
services.httpd.documentRoot = "${pkgs.valgrind.doc}/share/doc/valgrind/html";
networking.firewall.allowedTCPPorts = [ 80 ];
};
@bachp
bachp / shell.nix
Last active October 18, 2025 19:52
Yocto builds in using Nix
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
# Create a version of GCC without hardening flags as the hardening flags fail with yocot tries to compile gcc itself
wrapCCUnhard = wrapCCWith stdenv.cc.libc ''echo "#HACK Hardening disabled by removing all flags" > $out/nix-support/add-hardening.sh'';
gcc6unhard = lowPrio (wrapCCUnhard gcc6.cc);
in