Skip to content

Instantly share code, notes, and snippets.

View troglobit's full-sized avatar
🎯
Focusing

Joachim Wiberg troglobit

🎯
Focusing
View GitHub Profile
@wolfv
wolfv / fetch.sh
Created September 8, 2021 13:08
Fetch from OCI registry (ghcr.io)
export TOKEN=$(curl --silent https://ghcr.io/token\?scope\=repository:wolfv/artifact:pull | jq -r .token)
curl \
--silent \
--request 'GET' \
--header "Authorization: Bearer $TOKEN" \
--header "Accept: application/vnd.oci.image.manifest.v1+json" \
'https://ghcr.io/v2/wolfv/artifact/manifests/1.0'
echo "\n\nFetching image content now:\n\n"
@jonte
jonte / tmp105.md
Last active March 30, 2024 13:07
Emulating a tmp105 temperature sensor using QEMU and Linux

This will configure QEMU to expose a tmp105 temperature sensor on the i2c-0 bus on x86_64. The temterature sensor can have its temperature set from the host OS, and the temperature can be read from the Linux client OS using the lm75 kernel module.

Building QEMU

For convenience, we will be emulating an x86 system. The x86 configuations which QEMU ships with do not contain the tmp105 sensor we will be using, so first we need to enable it.

Assuming you have the qemu sources in the qemu directory:

# cd qemu

echo "CONFIG_TMP105=y" >> default-configs/i386-softmmu.mak

@troglobit
troglobit / howto-use-dd.md
Last active January 20, 2024 14:24
HowTo use dd to write a disk image/iso to USB on Linux

The UNIX utility dd is actually inherited from VMS, hence the opt=arg instead of --opt=arg syntax.

Here we write the input file (if) to the output file (of), using a larger block size (bs) than default (512 bytes). We'd like to see the progress of the write, this is not the default, and we want to avoid caching in the Linux VFS, so we set output flag (oflag) to direct, i.e. write-through.

sudo dd if=linuxmint-20-cinnamon-64bit.iso of=/dev/sdb bs=1M status=progress oflag=direct

Watch out, check the output file (/dev/sdb) matches your USB stick, otherwise you'll kill all the kittens!

@rg3915
rg3915 / gen_random_values_to_csv.sh
Created August 5, 2020 01:52
Generate random names and values with shell script - gpw random name gen name - gpw csv - random csv
# Generate random names and values with shell script.
echo "first_name,last_name,quantity" > /tmp/items.csv
for i in $(seq 1 20); do
first_name=$(gpw 1 7)
last_name=$(gpw 1 10)
quantity=$RANDOM
echo "$first_name,$last_name,$quantity" >> /tmp/items.csv
done
@stokito
stokito / haserl.md
Created July 12, 2020 09:50
Build template-able web page and more.

Build template-able web page and more.

busybox httpd

Start the httpd in debug mode:

$ busybox httpd -f -vvv -c ./httpd.conf

See config:

$ cat httpd.conf:
I:test.tt
@jonashackt
jonashackt / reveal.js-markdown-pandoc-github.md
Last active October 7, 2023 20:21
Reveal.js presentation Markdown Pandoc GitHub Pages

Reveal.js presentation with Markdown

Workflow

  1. Create GitHub repo & write Markdown into README.md (all the time, as you do research)

  2. Create gh-pages Branch & Markdown for presentation

  3. Use Pandoc to convert Markdown into Reveal.js HTML (locally)

@rikka0w0
rikka0w0 / sunxi_fel.md
Last active May 10, 2022 01:29
sunxi_fel.md
@zoilomora
zoilomora / README.md
Last active April 25, 2024 08:17
How to disable systemd-resolved in Ubuntu

How to disable systemd-resolved in Ubuntu

Stages

  • Disable and stop the systemd-resolved service:

      sudo systemctl disable systemd-resolved.service
      sudo systemctl stop systemd-resolved
    
  • Then put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:

@fergiemcdowall
fergiemcdowall / README.md
Last active April 8, 2024 09:26
How to use pandoc to generate HTML from GitHub-flavoured markdown

Here is a little recipe for generating html from github-flavoured markdown. CSS extracted and modified from https://github.com/sindresorhus/github-markdown-css on 22-05-2019. At some point this CSS will probably have to be updated, but for now it works.

  1. Install pandoc 2.x or higher

  2. Save github-markdown.css (below) to ´~/.pandoc/github-markdown.css´

  3. To convert a file called README.md (change as appropriate) run ´pandoc --standalone -c ~/.pandoc/github-markdown.css -f gfm -t html README.md´

@ryukinix
ryukinix / lock.sh
Last active March 24, 2023 13:46
How lock your system before suspend with openrc init via elogind using slock
#!/bin/sh
#
# /lib/elogind/system-sleep/lock.sh
# Lock before suspend integration with elogind
username=lerax
userhome=/home/$username
export XAUTHORITY="$userhome/.Xauthority"
export DISPLAY=":0.0"