Dev Notes - Issue 0

July 30, 2019 Dev Notes

Contents:

  • Upgrading to a new version of Fedora
  • Installing GNOME Shell extensions from Chrome
  • Enabling touchpad while typing in GNOME
  • How to include the first commit in git rebase
  • How to reduce git clone size
  • Converting DMG to ISO
  • Formatting partitions to HFS+
  • Making wget ignore nested folders
  • Checking if host is up on a network
  • Centering README content on GitHub
  • Removing BeautifulSoup elements
  • Removing accent symbols from words

1. Upgrade to a new version of Fedora

Install the latest updates:

sudo dnf upgrade --refresh

Install DNF plugin:

$ sudo dnf install dnf-plugin-system-upgrade

Download the update (replace 30 with your version):

$ sudo dnf system-upgrade download --refresh --releasever=30

Reboot and perform the install:

$ sudo dnf system-upgrade reboot

2. Install GNOME Shell extensions from Chrome

  1. Install shell plugin:
  • Fedora: sudo dnf install chrome-gnome-shell
  • Ubuntu: sudo apt-get install chrome-gnome-shell
  1. Install browser extension from Chrome Web Store.

3. Enable touchpad while typing in GNOME

Touchpad gets disabled by default in GNOME when keys are pressed. Such behaviour can be disturbing, especially in gaming.

First, check whether the “Disable touchpad while typing” setting is active:

$ gsettings get org.gnome.desktop.peripherals.touchpad disable-while-typing
true

It is. Set the value to false to disable this behaviour:

$ gsettings set org.gnome.desktop.peripherals.touchpad disable-while-typing false

Finally, ensure the change has been applied:

$ gsettings get org.gnome.desktop.peripherals.touchpad disable-while-typing
false

4. Include initial commit in git interactive rebase

Use the --root option together with -i.

$ git rebase -i --root

5. Reduce git clone size

This is called a shallow clone.

$ git clone URL --depth=1

6. Convert DMG to ISO

$ dmg2img in.dmg out.img

7. Format partitions to HFS+

Install HFS support package (for Fedora):

$ sudo dnf install hfsprogs

Format /dev/sdx1 to journaled HFS Plus:

$ sudo mkfs.hfsplus -J -v "Time Machine" /dev/sdx1

8. Make wget ignore nested folders

Use the --no-parent option.

$ wget -r --no-parent http://bin.entware.net/mipselsf-k3.4/

9. Check if host is up on a network

$ nmap -Pn 10.100.100.10
Starting Nmap 7.70 ( https://nmap.org ) at 2019-06-15 00:00 MSK
Nmap scan report for 10.100.100.10
Host is up.
All 1000 scanned ports on 10.100.100.10 are filtered

Nmap done: 1 IP address (1 host up) scanned in 201.43 seconds

10. Center README content on GitHub

Single image:

<p align="center">
  <img src="app/src/main/ic_launcher-web.png" width="200">
</p>

Multiple images in a row:

<div style="display:flex;">
<img alt="Login" src="screenshots/login.png" width="30%">
<img alt="Tasks" src="screenshots/calendar.png" width="30%">
<img alt="Calendar" src="screenshots/tasks.png" width="30%">
</div>

11. Remove BeautifulSoup elements

Just execute unwrap() method on the element instance. The following example shows how to remove all elements with a span tag.

soup = BeautifulSoup(doc, 'html.parser') # suppose `doc` contains an HTML
spans = soup.findAll("span")
for span in spans:
    span.unwrap()

12. Remove accent symbols from words

The following snippet makes word программи́рую look программирую [и́и].

def remove_accents(word):
    return ''.join((c for c in unicodedata.normalize('NFD', word) if unicodedata.category(c) != 'Mn'))
comments powered by Disqus