Skip to content

Instantly share code, notes, and snippets.

View Ruzzz's full-sized avatar

Ruslan Zaporojets Ruzzz

View GitHub Profile
#!/bin/bash
#
# Restore settings of Git, GPG, SSH and direnv settings
# Example: ./restore-git-opts.sh ~/git-opts-my-team ~/Projects/MyTeam
#
set -euo pipefail
if [ $# -lt 2 ]; then
#!/bin/bash
#
# Create an archive with Git, GPG, SSH and direnv settings
# Example: ./dump-git-opts.sh my-team ~/Projects/MyTeam
#
set -euo pipefail
if ! command -v realpath &>/dev/null; then
@Ruzzz
Ruzzz / gnupg_directory_permissions.sh
Last active February 1, 2023 23:36
gnupg directory permissions
chmod 700 ~/.gnupg
chmod 600 ~/.gnupg/*
find ~/.gnupg -type f -exec chmod 600 {}
find ~/.gnupg -type d -exec chmod 700 {}
@Ruzzz
Ruzzz / simple_parser.cpp
Created November 16, 2012 19:47
C++ Simple Parser
template <class T, class CharType>class Parser
{
Parser(T &t) :: m_curr(t.begin()) , m_end(t.end()) {}
bool next_char(CharType *c) {
bool not_eof = m_curr != m_end;
if (not_eof) {
*c = *m_curr;
m_curr++;
}
@Ruzzz
Ruzzz / oem_logon_background.bat
Created November 16, 2012 19:02
Windows OEM Logon Background Enable
REM run as admin, picture must be JPEG, picture size must be not more than 256KB
REM SET img_path=%1 or SET img_path="path to jpg" or
SET img_path=%~dp0background.jpg
SET bg_path=%SystemRoot%\system32\oobe\info\backgrounds
MD %bg_path%
COPY %img_path% %bg_path%\BackgroundDefault.jpg
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background" /v OEMBackground /t REG_DWORD /d 1 /f
REM Shadow of controls: 0 - transparent shadow, 1 - shadow, 2 - no shadow
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" /v ButtonSet /t REG_DWORD /d 1 /f
@Ruzzz
Ruzzz / andrd_emltr_root.bat
Last active November 25, 2021 01:01
Root for Android SDK Emulator
:: Contact: ruzzzua@gmail.com
:: Version: 2015.08.17
:: Dependencies: Android Debug Bridge (adb)
@echo off
set path="c:\Program Files\Android\android-sdk\platform-tools\";%path%
set abi=arm
:: adb remount
:: adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock03 /system
@Ruzzz
Ruzzz / build-python.md
Last active October 14, 2021 21:30
Build Python on Ubuntu

Python-3.7.0 - Ubuntu ??

sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential libbz2-dev libdb5.3-dev libexpat1-dev libffi-dev libgdbm-dev liblzma-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev tcl-dev tk-dev zlib1g-dev tk openssl

cd /opt
sudo curl -sL https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz | sudo tar xJ

cd Python-3.7.0
@Ruzzz
Ruzzz / dockerfile-entrypoint-cmd.md
Last active March 25, 2021 16:31
Dockerfile ENTRYPOINT + CMD
  • Shell form: exec param
  • Exec form: ["exec", "param"]
No ENTRYPOINT ENTRYPOINT e0 p0 ENTRYPOINT ["e0", "p0"]
No CMD error /bin sh -c e0 p0 e0 p0
CMD ["e1", "p1"] e1 p1 /bin sh -c e0 p0 e0 p0 e1 p1
CMD ["p1", "p2"] p1 p2 /bin sh -c e0 p0 e0 p0 p1 p2
CMD e1 p1 /bin sh -c e1 p1 /bin sh -c e0 p0 e0 p0 /bin sh -c e1 p1
@Ruzzz
Ruzzz / ssh_directory_permissions.sh
Last active September 28, 2020 11:48
ssh directory permissions
chmod 700 ~/.ssh
chmod 644 ~/.ssh/*
chmod 600 ~/.ssh/id_rsa
@Ruzzz
Ruzzz / postgres_11_hints.md
Last active February 24, 2020 17:45
postgres 11 hints

Pre-installation cleanup

dpkg -l | grep postgres
sudo apt-get purge postgresql*  # or
sudo apt-get --purge remove postgresql\*

sudo rm -rf /var/lib/postgresql/
sudo rm -rf /var/log/postgresql/
sudo rm -rf /etc/postgresql/