Skip to content

Instantly share code, notes, and snippets.

View yordanoweb's full-sized avatar

Yordano Pascual Rivera yordanoweb

  • Freelancer
  • Las Tunas, Cuba
View GitHub Profile
@yordanoweb
yordanoweb / flutter_proj_no_android_studio.md
Last active June 15, 2022 18:55
Create Flutter project without Android Studio in ArchLinux

Install packages

sudo pacman -S flutter dart kotlin android-sdk android-sdk-platform-tools android-sdk-build-tools \
               android-platform android-sdk-cmdline-tools-latest jdk17-openjdk

Note: The required JDK must be higher than 11.

Set required environment variables

@yordanoweb
yordanoweb / fix_libnss3_firefox_error.md
Last active July 7, 2022 21:26
Fix NSS error after upgrade Firefox in ArchLinux

Error after upgrading Firefox in ArchLinux:

XPCOMGlueLoad error for file /usr/lib/firefox/libxul.so:
/usr/lib/libnss3.so: version `NSS_3.79' not found (required by /usr/lib/firefox/libxul.so)
Couldn't load XPCOM.

Updated the next following packages:

@yordanoweb
yordanoweb / bspwm_ubuntu.md
Last active July 9, 2022 21:03
Trying to replicate ArchCraft visuals on Ubuntu 20.04

Install required packages

sudo apt install bspwm rofi dunst vim ranger htop compton feh xclip install xfce4-settings \
 xsettingsd pavucontrol ncmpcpp mpd

Copy .Xresources, BSPWM, Rofi and Sxhkd configs

From existing installation, copy the following files and directories to user home:

@yordanoweb
yordanoweb / gpg_encrypt_decrypt.md
Created July 14, 2022 15:57
Encrypt and decrypt file using GPG (password protected)

Encrypt

gpg -o output-file.asc --armor --symmetric --cipher-algo AES256 input-file.txt

Decrypt

To decrypt output-file.asc or whatever you called it, run:

Capture outgoing connections and HTTP GET/POST requests

tcpdump -i wlan0 -w /tmp/wlan0.pcap -C 50 -A -n -K '(tcp[tcpflags] & (tcp-syn) != 0) \
        or ((tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420) and less 1024) \
        or ((tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x504F5354) and less 1024)' &

Notes

@yordanoweb
yordanoweb / hdmi_handling.md
Last active August 19, 2022 23:34
Activate and deactivate HDMI in Linux manually

HDMI handling in Linux

  • HDMI1 output to right screen
xrandr --output HDMI1 --mode 1366x768 --right-of eDP1   
  • Deactivate right HDM1 output screen
@yordanoweb
yordanoweb / mencoder-ass-subtitles.md
Last active August 22, 2022 03:07
Encode videos with mencoder and subtitles format (font size, color and more...)

Pass to mencoder the right parameters

  • Note the -ass-force-style and the -ass parameters...
  • Also, note the extension of the subtitles file is a .srt file
  • The rest of the options are for video encoder, video format, size, bitrate, etc... In this example we encode to AVI XVID with MP3 audio.
nice -n 10 /usr/bin/mencoder "/home/john/Videos/Red.mp4" -o "/home/john/Videos/Red.avi" \
   -ass-force-style "FontSize=32,PrimaryColour=&H00ffff,Bold=1,MarginV=24" \
 -ass /home/john/Videos/Red.srt -ofps 24 -vf softskip,scale=700:300:0,harddup \
@yordanoweb
yordanoweb / ssh-socks.md
Created October 27, 2022 23:43
SSH through a SOCKS proxy

Connect to remote host using a SOCKS proxy

If we have Tor service running locally or any other SOCKS service available at 9050 port on localhost, then we can go like this:

ssh -o ProxyCommand='nc -x 127.0.0.1:9050 %h %p' user@server.com
@yordanoweb
yordanoweb / squid_https_cached.conf
Last active November 1, 2022 00:59
Squid Cache configuration for caching HTTPS
##################################################################################################################
# openssl req -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -extensions v3_ca -keyout squid-ca-key.pem -out squid-ca-cert.pem
# cat squid-ca-cert.pem squid-ca-key.pem >> squid-ca-cert-key.pem
# sudo mkdir /etc/squid/certs
# sudo mv squid-ca-cert-key.pem /etc/squid/certs/
# sudo chown proxy:proxy -R /etc/squid/certs
# sudo /usr/lib/squid/security_file_certgen -c -s /var/cache/squid/ssl_db -M16MB
# sudo chown -R proxy:proxy /var/cache/squid/ssl_db
# sudo systemctl restart squid
# echo After this, import in Firefox or Chrome (Settings -> Security -> Certificates -> Authorities)
@yordanoweb
yordanoweb / i3status.md
Last active November 2, 2022 17:47
A brief i3 status bar config with JSON

Prepare i3 for the status script output

In the $HOME/.config/i3/config set the bar section to this:

bar {
        # comment this line as it is the default value
        # status_command i3status
        status_command /path/to/your/script.sh
}