From 359a92f770e621828e628f319290bb5736b1f67b Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 9 Feb 2020 10:24:03 +0530 Subject: new styles, new post! --- docs/favicon.png | Bin 621 -> 618 bytes docs/index.html | 17 +++ docs/posts/WPA_woes/index.html | 21 ++-- docs/posts/bash_harder_with_vim/index.html | 9 +- docs/posts/bye_bye_BDFs/index.html | 3 +- docs/posts/call_to_ARMs/index.html | 131 +++++++++++++++++++++ docs/posts/color_conundrum/index.html | 5 +- .../index.html | 19 +-- docs/posts/hold_position!/index.html | 7 +- docs/posts/my_setup/index.html | 5 +- docs/posts/onivim_sucks/index.html | 11 +- docs/posts/static_sites_with_bash/index.html | 27 +++-- docs/style.css | 4 + post.esh | 1 + posts/call_to_ARMs.md | 84 +++++++++++++ 15 files changed, 295 insertions(+), 49 deletions(-) create mode 100644 docs/posts/call_to_ARMs/index.html create mode 100644 posts/call_to_ARMs.md diff --git a/docs/favicon.png b/docs/favicon.png index 311ce53..030ef01 100644 Binary files a/docs/favicon.png and b/docs/favicon.png differ diff --git a/docs/index.html b/docs/index.html index c400f7e..1021db6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -20,6 +20,23 @@
+ + + + +
+
+ 09/02 — 2020 +
+ + Call To ARMs + +
+ + 2.2 + + min +
diff --git a/docs/posts/WPA_woes/index.html b/docs/posts/WPA_woes/index.html index a4ef973..a676210 100644 --- a/docs/posts/WPA_woes/index.html +++ b/docs/posts/WPA_woes/index.html @@ -10,6 +10,7 @@ + WPA Woes - peppe.rs
@@ -36,16 +37,16 @@ WPA Woes
-

I finally got around to installing Void GNU/Linux on my main +

I finally got around to installing Void GNU/Linux on my main computer. Rolling release, non-systemd, need I say more?

-

As with all GNU/Linux distributions, wireless networks had -me in a fix. If you can see this post, it means I’ve managed +

As with all GNU/Linux distributions, wireless networks had +me in a fix. If you can see this post, it means I've managed to get online. It turns out, wpa_supplicant was detecting the wrong interface by default (does it ever select the right one?). Let us fix that:

-
$ sudo rm -r /var/service/wpa_supplicant
+
$ sudo rm -r /var/service/wpa_supplicant
 $ sudo killall dhcpcd
 
@@ -60,7 +61,7 @@ $ sudo killall dhcpcd

Aha! Let us run wpa_supplicant on that interface, as a background process:

-
$ sudo wpa_supplicant -B -i wlp2s0 -c /etc/wpa_supplicant/wpa_supplicant.conf
+
$ sudo wpa_supplicant -B -i wlp2s0 -c /etc/wpa_supplicant/wpa_supplicant.conf
 $ sudo dhcpcd -B wlp2s0
 $ ping google.com
 PING ...
@@ -69,12 +70,12 @@ PING ...
 

Yay! Make those changes perpetual by enabling the service:

------------------------------------------------------
-# Add these to /etc/wpa_supplicant/wpa_supplicant.conf
-OPTS="-B"
-WPA_INTERFACE="wlp2s0"
+# Add these to /etc/wpa_supplicant/wpa_supplicant.conf
+OPTS="-B"
+WPA_INTERFACE="wlp2s0"
 ------------------------------------------------------
-$ sudo ln -s /etc/sv/wpa_supplicant /var/service/
-$ sudo ln -s /etc/sv/dhcpcd /var/service/
+$ sudo ln -s /etc/sv/wpa_supplicant /var/service/
+$ sudo ln -s /etc/sv/dhcpcd /var/service/
 $ sudo sv restart wpa_supplicant
 $ sudo sv restart dhcpcd
 
diff --git a/docs/posts/bash_harder_with_vim/index.html b/docs/posts/bash_harder_with_vim/index.html index 7d6d7b3..c9303a6 100644 --- a/docs/posts/bash_harder_with_vim/index.html +++ b/docs/posts/bash_harder_with_vim/index.html @@ -10,6 +10,7 @@ + Bash Harder With Vim - peppe.rs
@@ -36,7 +37,7 @@ Bash Harder With Vim
-

Bash is tricky, don’t let your editor get in your way. Here’s a couple of neat +

Bash is tricky, don't let your editor get in your way. Here's a couple of neat additions you could make to your vimrc for a better shell programming experience.

@@ -44,7 +45,7 @@ experience.

Source this script to get started:

-
runtime ftplugin/man.vim
+
runtime ftplugin/man.vim
 

Now, you can open manpages inside vim with :Man! It adds nicer syntax highlighting @@ -61,7 +62,7 @@ and the ability to jump around with Ctrl-] and Ctrl-T. a sample from the script used to generate this site:

# a substitution to convert snake_case to Title Case With Spaces
-echo "$1" | sed -E -e "s/\..+$//g"  -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g"
+echo "$1" | sed -E -e "s/\..+$//g"  -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g"
 

Instead of dropping into a new shell, just test it out directly from vim!

@@ -80,7 +81,7 @@ echo "$1" | sed -E -e "s/\..+$//g" -e "s/_(.)/ \u\1/g&
syntax off            # previously run commands
 edit index.html       # in a buffer!
 w | so %
-!echo "new_post.md" | sed -E -e "s/\..+$//g"  --snip--
+!echo "new_post.md" | sed -E -e "s/\..+$//g"  --snip--
 ^--- note the use of '!'
 
  • Hit enter with the cursor on the line containing your command!

    diff --git a/docs/posts/bye_bye_BDFs/index.html b/docs/posts/bye_bye_BDFs/index.html index 74a58d0..73c8512 100644 --- a/docs/posts/bye_bye_BDFs/index.html +++ b/docs/posts/bye_bye_BDFs/index.html @@ -10,6 +10,7 @@ + Bye Bye BDFs - peppe.rs
    @@ -52,7 +53,7 @@ provided no advantage over Harfbuzz (other than being able to fetch opentype metrics with ease).

    Upgrading to Pango v1.44 will break your GTK applications (if you use a -bdf/pcf bitmap font). Harfbuzz does support bitmap-only OpenType fonts, +bdf/pcf bitmap font). Harfbuzz does support bitmap-only OpenType fonts, otbs. Convert your existing fonts over to otbs using FontForge. It is to be noted that applications such as xterm and rxvt use xft (X FreeType) to render fonts, and will diff --git a/docs/posts/call_to_ARMs/index.html b/docs/posts/call_to_ARMs/index.html new file mode 100644 index 0000000..4085a90 --- /dev/null +++ b/docs/posts/call_to_ARMs/index.html @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + Call To ARMs - peppe.rs + +

    +
    + ⟵ Back + View Raw +
    +
    + 09/02 — 2020 +
    + + 33.57 + + cm +   + + 2.2 + + min +
    +
    + + Call To ARMs + +
    +

    My 4th semester involves ARM programming. And proprietary +tooling (Keil C). But we don't do that here.

    + +

    Building

    + +

    Assembling and linking ARM binaries on non-ARM architecture +devices is fairly trivial. I went along with the GNU cross +bare metal toolchain binutils, which provides arm-as and +arm-ld (among a bunch of other utils that I don't care +about for now).

    + +

    Assemble .s files with:

    + +
    arm-none-eabi-as main.s -g -march=armv8.1-a -o main.out
    +
    + +

    The -g flag generates extra debugging information that +gdb picks up. The -march option establishes target +architecture.

    + +

    Link .o files with:

    + +
    arm-none-eabi-ld main.out -o main
    +
    + +

    Running (and Debugging)

    + +

    Things get interesting here. gdb on your x86 machine +cannot read nor execute binaries compiled for ARM. So, we +simulate an ARM processor using qemu. Now qemu allows you +to run gdbserver on startup. Connecting our local gdb +instance to gdbserver gives us a view into the program’s +execution. Easy!

    + +

    Run qemu, with gdbserver on port 1234, with our ARM +binary, main:

    + +
    qemu-arm -singlestep -g 1234 main
    +
    + +

    Start up gdb on your machine, and connect to qemu’s +gdbserver:

    + +
    (gdb) set architecture armv8-a
    +(gdb) target remote localhost:1234
    +(gdb) file main
    +Reading symbols from main...  # yay!
    +
    + +

    GDB Enhanced

    + +

    gdb is cool, but it's not nearly as comfortable as well +fleshed out emulators/IDEs like Keil. Watching registers, +CPSR and memory chunks update is pretty fun.

    + +

    I came across gdb's TUI mode (hit C-x C-a or type tui +enable at the prompt). TUI mode is a godsend. It highlights +the current line of execution, shows you disassembly +outputs, updated registers, active breakpoints and more.

    + +

    But, it is an absolute eyesore.

    + +

    Say hello to GEF! “GDB +Enhanced Features” teaches our old dog some cool new tricks. +Here are some additions that made my ARM debugging +experience loads better:

    + +
      +
    • Memory watches
    • +
    • Register watches, with up to 7 levels of deref (overkill, +I agree)
    • +
    • Stack tracing
    • +
    + +

    And its pretty! See for yourself:

    + +

    gef.png

    + +

    Editing

    + +

    Vim, with syntax off because it +dosen't handle GNU ARM syntax too well.

    + +
    +
    + ⟵ Back + View Raw +
    +
    + + diff --git a/docs/posts/color_conundrum/index.html b/docs/posts/color_conundrum/index.html index 4182e00..de099f2 100644 --- a/docs/posts/color_conundrum/index.html +++ b/docs/posts/color_conundrum/index.html @@ -10,6 +10,7 @@ + Color Conundrum - peppe.rs
    @@ -53,7 +54,7 @@ technical terms used?

    Prose and code are certainly different, but the fickle minded human eye is the same. The eye constantly looks for a frame of reference, a focal point. It grows tired when it -can’t find one.

    +can't find one.

    The following comparison does a better job of explaining (none, ample and over-the-top highlighting, from left to @@ -70,7 +71,7 @@ keywords and other noise (let, as) are mildly dimmed out. Comments and non-code text (sign column, status text) are dimmed further.

    -

    I’ll stop myself before I rant about color contrast and +

    I'll stop myself before I rant about color contrast and combinations.

    diff --git a/docs/posts/get_better_at_yanking_and_putting_in_vim/index.html b/docs/posts/get_better_at_yanking_and_putting_in_vim/index.html index 76d59be..1c77c44 100644 --- a/docs/posts/get_better_at_yanking_and_putting_in_vim/index.html +++ b/docs/posts/get_better_at_yanking_and_putting_in_vim/index.html @@ -10,6 +10,7 @@ + Get Better At Yanking And Putting In Vim - peppe.rs
    @@ -39,23 +40,23 @@
    1. reselecting previously selected text (i use this to fix botched selections):

      -
      gv  " :h gv for more
      -    " you can use `o` in visual mode to go to the `Other` end of the selection
      -    " use a motion to fix the selection
      +
      gv  " :h gv for more
      +    " you can use `o` in visual mode to go to the `Other` end of the selection
      +    " use a motion to fix the selection
       
    2. reselecting previously yanked text:

      `[v`]
      -`[         " marks the beginning of the previously yanked text   :h `[
      -`]         " marks the end                                       :h `]
      - v         " visual select everything in between
      +`[         " marks the beginning of the previously yanked text   :h `[
      +`]         " marks the end                                       :h `]
      + v         " visual select everything in between
       
      -nnoremap gb `[v`]    " "a quick map to perform the above
      +nnoremap gb `[v`]    " "a quick map to perform the above
       
    3. pasting and indenting text (in one go):

      -
      ]p   " put (p) and adjust indent to current line
      -]P   " put the text before the cursor (P) and adjust indent to current line
      +
      ]p   " put (p) and adjust indent to current line
      +]P   " put the text before the cursor (P) and adjust indent to current line
       
    diff --git a/docs/posts/hold_position!/index.html b/docs/posts/hold_position!/index.html index 54d9b72..8cc77fe 100644 --- a/docs/posts/hold_position!/index.html +++ b/docs/posts/hold_position!/index.html @@ -10,6 +10,7 @@ + Hold Position! - peppe.rs
    @@ -50,11 +51,11 @@ none of which concern us.

    our view, and restore it once its done, with winrestview.

    let view = winsaveview()
    -s/\s\+$//gc              " find and (confirm) replace trailing blanks
    -winrestview(view)        " restore our original view!
    +s/\s\+$//gc              " find and (confirm) replace trailing blanks
    +winrestview(view)        " restore our original view!
     
    -

    It might seem a little overkill in the above example, just use “ (double +

    It might seem a little overkill in the above example, just use `` (double backticks) instead, but it comes in handy when you run your file through heavier filtering.

    diff --git a/docs/posts/my_setup/index.html b/docs/posts/my_setup/index.html index f652a38..4ac9d91 100644 --- a/docs/posts/my_setup/index.html +++ b/docs/posts/my_setup/index.html @@ -10,6 +10,7 @@ + My Setup - peppe.rs
    @@ -46,10 +47,10 @@ to replicate on fresh installations. You can find my configuration files on GitHub.

    I run Void Linux (glibc) on my -HP Envy 13" (2018). +HP Envy 13” (2018). To keep things simple, I run a raw X session with 2bwm as my window manager, along with dunst (notification daemon) and -Sam’s compton +Sam's compton (compositor) fork.

    I am a fan of GNU tools, so I use bash as my shell, and diff --git a/docs/posts/onivim_sucks/index.html b/docs/posts/onivim_sucks/index.html index e1053c1..d3718d7 100644 --- a/docs/posts/onivim_sucks/index.html +++ b/docs/posts/onivim_sucks/index.html @@ -10,6 +10,7 @@ + Onivim Sucks - peppe.rs

    @@ -37,7 +38,7 @@

    Onivim is a ‘modern modal editor’, combining fancy -interface and language features with vim-style modal editing. What’s wrong you +interface and language features with vim-style modal editing. What's wrong you ask?

    Apart from buggy syntax highlighting, @@ -47,19 +48,19 @@ Onivim is proprietary software. It is licensed under a commerci end user agreement license, which prohibits redistribution in both object code and source code formats.

    -

    Onivim’s core editor logic (bits that belong to vim), have been separated from +

    Onivim's core editor logic (bits that belong to vim), have been separated from the interface, into libvim. libvim is licensed under MIT, which means, this ‘extension’ of vim is perfectly in -adherence to vim’s license text! +adherence to vim's license text! Outrun Labs are exploiting this loophole (distributing vim as a library) to commercialize Onivim.

    -

    Onivim’s source code is available on GitHub. +

    Onivim's source code is available on GitHub. They do mention that the source code trickles down to the oni2-mit repository, which (not yet) contains MIT-licensed code, 18 months after each commit to the original repository.

    -

    Want to contribute to Onivim? Don’t. They make a profit out of your contributions. +

    Want to contribute to Onivim? Don't. They make a profit out of your contributions. Currently, Onivim is priced at $19.99, ‘pre-alpha’ pricing which is 80% off the final price! If you are on the lookout for an editor, I would suggest using Vim, charity ware that actually works, and costs $100 lesser.

    diff --git a/docs/posts/static_sites_with_bash/index.html b/docs/posts/static_sites_with_bash/index.html index 7c1adda..9eb4846 100644 --- a/docs/posts/static_sites_with_bash/index.html +++ b/docs/posts/static_sites_with_bash/index.html @@ -10,6 +10,7 @@ + Static Sites With Bash - peppe.rs
    @@ -51,17 +52,17 @@ to html with lowdown.

    Directory structure

    I host my site on GitHub pages, so -docs/ has to be the entry point. Markdown formatted posts -go into posts/, get converted into html, and end up in -docs/index.html, something like this:

    +docs/ has to be the entry point. Markdown formatted posts +go into posts/, get converted into html, and end up in +docs/index.html, something like this:

    -
    posts=$(ls -t ./posts)     # chronological order!
    +
    posts=$(ls -t ./posts)     # chronological order!
     for f in $posts; do
    -    file="./posts/"$f      # `ls` mangled our file paths
    -    echo "generating post $file"
    +    file="./posts/"$f      # `ls` mangled our file paths
    +    echo "generating post $file"
     
    -    html=$(lowdown "$file")
    -    echo -e "html" >> docs/index.html
    +    html=$(lowdown "$file")
    +    echo -e "html" >> docs/index.html
     done
     
    @@ -72,15 +73,15 @@ assets into the site source itself. That does have it’s merits, but I prefer hosting images separately:

    # strip file extension
    -ext="${1##*.}"
    +ext="${1##*.}"
     
     # generate a random file name
    -id=$( cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 2 | head -n 1 )
    -id="$id.$ext"
    +id=$( cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 2 | head -n 1 )
    +id="$id.$ext"
     
     # copy to my file host
    -scp -P 443 "$1" emerald:files/"$id" 
    -echo "https://u.peppe.rs/$id"
    +scp -P 443 "$1" emerald:files/"$id" 
    +echo "https://u.peppe.rs/$id"
     

    Templating

    diff --git a/docs/style.css b/docs/style.css index b09fed8..be19ad0 100644 --- a/docs/style.css +++ b/docs/style.css @@ -173,6 +173,10 @@ a, a:hover, a:visited, a:active { font-size: 0.9rem; } +ul { + list-style: lower-greek inside none; +} + pre, code { color: var(--black); font-family: monospace; diff --git a/post.esh b/post.esh index 413e165..cc23a2d 100644 --- a/post.esh +++ b/post.esh @@ -10,6 +10,7 @@ + <%=$title%> - peppe.rs
    diff --git a/posts/call_to_ARMs.md b/posts/call_to_ARMs.md new file mode 100644 index 0000000..c4ce60a --- /dev/null +++ b/posts/call_to_ARMs.md @@ -0,0 +1,84 @@ +My 4th semester involves ARM programming. And proprietary +tooling (Keil C). But we don't do that here. + +### Building + +Assembling and linking ARM binaries on non-ARM architecture +devices is fairly trivial. I went along with the GNU cross +bare metal toolchain binutils, which provides `arm-as` and +`arm-ld` (among a bunch of other utils that I don't care +about for now). + +Assemble `.s` files with: + +```shell +arm-none-eabi-as main.s -g -march=armv8.1-a -o main.out +``` + +The `-g` flag generates extra debugging information that +`gdb` picks up. The `-march` option establishes target +architecture. + +Link `.o` files with: + +```shell +arm-none-eabi-ld main.out -o main +``` + +### Running (and Debugging) + +Things get interesting here. `gdb` on your x86 machine +cannot read nor execute binaries compiled for ARM. So, we +simulate an ARM processor using `qemu`. Now qemu allows you +to run `gdbserver` on startup. Connecting our local `gdb` +instance to `gdbserver` gives us a view into the program's +execution. Easy! + +Run `qemu`, with `gdbserver` on port `1234`, with our ARM +binary, `main`: + +```shell +qemu-arm -singlestep -g 1234 main +``` + +Start up `gdb` on your machine, and connect to `qemu`'s +`gdbserver`: + +``` +(gdb) set architecture armv8-a +(gdb) target remote localhost:1234 +(gdb) file main +Reading symbols from main... # yay! +``` + +### GDB Enhanced + +`gdb` is cool, but it's not nearly as comfortable as well +fleshed out emulators/IDEs like Keil. Watching registers, +CPSR and memory chunks update *is* pretty fun. + +I came across `gdb`'s TUI mode (hit `C-x C-a` or type `tui +enable` at the prompt). TUI mode is a godsend. It highlights +the current line of execution, shows you disassembly +outputs, updated registers, active breakpoints and more. + +*But*, it is an absolute eyesore. + +Say hello to [GEF](https://github.com/hugsy/gef)! "GDB +Enhanced Features" teaches our old dog some cool new tricks. +Here are some additions that made my ARM debugging +experience loads better: + + - Memory watches + - Register watches, with up to 7 levels of deref (overkill, + I agree) + - Stack tracing + +And its pretty! See for yourself: + +![gef.png](https://u.peppe.rs/wq.png) + +### Editing + +Vim, with `syntax off` because it +dosen't handle GNU ARM syntax too well. -- cgit v1.2.3