Skip to content

Instantly share code, notes, and snippets.

View geolimber's full-sized avatar

Sergio Marchenko (CA2MYX) geolimber

View GitHub Profile
@geolimber
geolimber / README.md
Last active May 4, 2022 19:08
Install Python3.9.4 and Apache mod_wsgi on Debian (AWS Lightsail, EC2)

Install latest Python and Apache mod_wsgi on Debian (AWS Lightsail, EC2)

Step 1. Download python binaries

wget https://www.python.org/ftp/python/3.9.4/Python-3.9.4.tgz
tar zxvf Python-3.9.4.tgz
cd Python-3.9.4

Step 2. Configure building python from sources

@geolimber
geolimber / santa
Created August 15, 2020 04:20
Script to retrieve values for your bank transfer coordinates, stored in encrypted gpg file. Put script in your PATH and don't forget chmod +x. Obviously you need to prepare your transfer coordinates file. This will ask your gpg passcode on runtime.
#!/bin/bash
#-----------------------------#
# Example content of .gpg file:
# declare -a a=(01 02 03 04 05)
# declare -a b=(01 02 03 04 05)
# declare -a c=(01 02 03 04 05)
# declare -a d=(01 02 03 04 05)
# ....
# Usage: santa a1 e4 j2
#-----------------------------#
@geolimber
geolimber / config
Created February 25, 2020 20:03
i3wm basic config from manjaro
# i3 config file (v4)
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
# Set mod key (Mod1=<Alt>, Mod4=<Super>)
set $mod Mod4
# set default desktop layout (default is tiling)
# workspace_layout tabbed <stacking|tabbed>
# Configure border style <normal|1pixel|pixel xx|none|pixel>
@geolimber
geolimber / tmux_on_awsEC2.sh
Created December 18, 2019 19:05
Install fresh tmux on aws Amazon Linux distribution (EC2)
#!/bin/sh
# Unfortunately on aws Amazon Linux distribution Tmux version is bit outdated (1.8)
# Here is solution how you can get more recent version (3.0a available in dic 2019)
sudo yum install libevent-devel ncurses-devel
wget https://github.com/tmux/tmux/releases/download/3.0a/tmux-3.0a.tar.gz
cd tmux-3.0a/
./configure
make
sudo make install
@geolimber
geolimber / webm2mp3 ffmpeg
Created December 27, 2018 06:11
Finds all *.webm files in current folder and subfolders and converts it to mp3 using ffmpeg
find . -type f -iname "*.webm" -exec bash -c 'FILE="$1"; ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -y "${FILE%.webm}.mp3";' _ '{}' \;
@geolimber
geolimber / map-list.sh
Last active December 8, 2018 05:26
Just small perfomance test of map and list comp.
# map test without lambda
python3 -mtimeit -s'xs=range(10)' 'map(hex, xs)'
python3 -mtimeit -s'xs=range(10)' '[hex(x) for x in xs]'
# map lambda test
python3 -mtimeit -s'xs=range(10)' 'map(lambda x: x+2, xs)'
python3 -mtimeit -s'xs=range(10)' '[x+2 for x in xs]'
@geolimber
geolimber / ExtensionChecker.java
Last active February 5, 2018 16:46
Simple java class to get file extension
/**
* Simple java class to get file extension.
* Returns null if file starts with point, like .htaccess, and if the file don't have any extension.
* Created by Sergio Marchenko on 05-05-2017.
*/
public class ExtensionChecker {
public static String getFileExtension(String fileName) {
if (!fileName.startsWith(".") && fileName.contains(".")) {
return fileName.substring(fileName.lastIndexOf(".") + 1);
}