Skip to content

Instantly share code, notes, and snippets.

@beci
beci / docker-compose-postgres-with-healt-check.txt
Last active November 7, 2022 22:26
A sample (from featmap) docker service definition with healthcheck
# link https://gist.githubusercontent.com/beci/e968d16363e71c77a1aa0495cdde5161/raw/c6a39779c8a951283f38af0d390484f6bb2ee837/docker-compose-postgres-with-healt-check.txt
#
postgres:
image: postgres:11-alpine
restart: always
volumes:
- ${PWD}/data:/var/lib/postgresql/data
environment:
POSTGRES_DB: ${FEATMAP_DB}
POSTGRES_USER: ${FEATMAP_DB_USER}
@beci
beci / convert-and-split.sh
Created July 1, 2021 05:59 — forked from a-r-d/convert-and-split.sh
How to take an annoying APE + CUE file cd rip and convert it into a set of FLAC or MP3 files on ubuntu.
#first install all the things:
sudo apt-get install flac ffmpeg mp3splt libav-tools shntool
# Okay first lets do an MP3:
# input files:
# --> cd.ape
# --> cp.cue
# (there are other options, like bitrate, but this is just the bare bones)
avconv -i cd.ape cd.mp3

Notes about the machine

The hardware

  • Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
  • Gigabyte X79-UD3
  • 16GiB RAM, DDR3-1866, 2x Corsair CMZ12GX3M3A16, 2x Kingston KHX1600C9D3/4

Linux settings

#!/usr/bin/env bash
#curl -s https://gist.githubusercontent.com/beci/53cddb049995d9994e41f119b8b03a87/raw/bfb6afa1a37a8c03240c7961c69d4a796fe5812e/aws-arch-eu-central1.sh | bash
#aws ec2 describe-images --owners 093273469852 --filters "Name=root-device-type,Values=ebs" --filters "Name=virtualization-type,Values=hvm" --query 'Images[*].[Name]' --output text
#aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,State.Name,LaunchTime,PublicDnsName,PublicIpAddress,KeyName,InstanceType]'
# run by curl
sudo pacman -S --noconfirm pacman-contrib
@beci
beci / downgrade python for pytorch and tensorflow, 3.8 to 3.7.md
Last active February 6, 2020 18:08
Machine learning packages a step behind python releases. Python is upgraded to 3.8 in arch linux based distros recently, but pytorch and tensorflow support up to 3.7 yet

downgrade python for pytorch and tensorflow

1. install the required version of python

On arch linux python37 from AUR, using yay:

yay -S python37
2. create the virtual environment with the installed version of python
python3.7 -m venv venv
@beci
beci / aur_speed_up.md
Last active February 15, 2024 18:26
Speed up compiling of AUR packages in arch linux

Edit /etc/makepkg.conf

replace in CFLAGS and CXXFLAGS to use the native one

-march=x86-64 -mtune=generic to -march=native

speed up build by set multiple threads

MAKEFLAGS="-j$(nproc)"

# with filter for only enabled
Get-ADUser -LDAPFilter "(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))" -Properties * | select Name,UserPrincipalName,Enabled,LockedOut,Created,LastLogonDate | ConvertTo-Json > users_f.json
# with all users
Get-ADUser -Filter * -Properties * | select Name,UserPrincipalName,Enabled,LockedOut,Created,LastLogonDate | ConvertTo-Json > users.json
@beci
beci / 256 colors.md
Created March 11, 2019 11:57 — forked from limingjie/256 colors.md
256 colors in putty, tmux/screen and vim

#256 colors in putty, tmux/screen and vim There is a detailed answer on stackoverflow. If you are looking for a short one, here it is.

  • putty

    Set Connection -> Data -> Terminal-type string to xterm-256color

  • tmux

Add this line to ~/.tmux.conf

@beci
beci / qbittorrent as default magnet handler
Created September 9, 2018 19:31
Set qbittorrent as default magnet link handler in gnome (arch)
# step 1: install xdg-utils
sudo pacman -S xdg-utils
# step 2: set qbittorrent to default magnet hangler
xdg-mime default qbittorrent.desktop x-scheme-handler/magnet
gci -inc bin,obj -rec | rm -rec -force
# without alias: Get-ChildItem -inc bin,obj -rec | Remove-Item -rec -force