Skip to content

Instantly share code, notes, and snippets.

View shmidt's full-sized avatar

Dima Shmidt shmidt

View GitHub Profile
@shmidt
shmidt / gist:233011e5365f0398aa1644f291b0b929
Last active February 27, 2024 20:29
Install Gnome on LMDE
sudo apt-get update
sudo apt-get -y install gdm3
sudo service gdm start
sudo tasksel
# select ‘GNOME’
sudo dpkg-reconfigure gdm3
sudo systemctl stop lightdm
@shmidt
shmidt / gist:4f120425627088b6eb1faf7997bbd4ba
Created August 3, 2023 19:47
Change to fish shell on Mac
sudo chown $(whoami) /etc/shells
sudo echo $(which fish) >> /etc/shells
chsh -s $(which fish)
@shmidt
shmidt / StringExtension.swift
Created August 28, 2022 02:18
StringExtension.swift
// https://stackoverflow.com/a/56763580/592035
extension String {
subscript(_ i: Int) -> String {
let idx1 = index(startIndex, offsetBy: i)
let idx2 = index(idx1, offsetBy: 1)
return String(self[idx1..<idx2])
}
subscript (r: Range<Int>) -> String {
let start = index(startIndex, offsetBy: r.lowerBound)
@shmidt
shmidt / Observable.swift
Created March 12, 2022 06:47 — forked from kumabook/Observable.swift
Observer pattern with swift protocol extension
import Foundation
public protocol Observer: Equatable {
associatedtype EventType
func listen(_ event: EventType)
}
public protocol Observable {
associatedtype ObserverType: Observer
associatedtype EventType
@shmidt
shmidt / change_shell.sh
Created October 26, 2021 23:19
Change shell to Fish
myshell=fish
brew install $myshell
which $myshell | sudo tee -a /etc/shells
chsh -s $(which $myshell)
@shmidt
shmidt / install_rails.md
Last active January 4, 2022 01:35
Installing Ruby on Rails on Fedora 34 via Homebrew
sudo dnf group install "C Development Tools and Libraries" "Development Tools" -y
sudo dnf install ruby-devel zlib-devel -y
sudo dnf install procps-ng curl file git libxcrypt-compat -y

install brew from https://brew.sh

echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> $HOME/.bash_profile

For the fish shell

@shmidt
shmidt / fedora_post_install.md
Last active May 27, 2023 22:15 — forked from zobayer1/fedora_post_install.md
Fedora 34 Post Installation (For Developers). Things you should do after installing your new Fedora workstation.

Fedora 34 Post Installation (For Developers)

Things you should do after installing your new Fedora workstation.

Fix kernel panic when computer turns off

sudo nano -w /etc/default/grub
Append blacklist string GRUB_CMDLINE_LINUX="rhgb quiet initcall_blacklist=dw_i2c_init_driver"
Ctrl + O Save the file.
sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
@shmidt
shmidt / install_python.sh
Last active November 8, 2020 04:11
Install Python on Raspbian
# Thanks to https://www.ramoonus.nl/2020/10/06/how-to-install-python-3-9-on-raspberry-pi/
# sudo ./install_python.sh 3.9.0
version=$1
sudo apt-get install -y build-essential tk-dev libncurses5-dev \
libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev \
libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev
wget https://www.python.org/ftp/python/$version/Python-$version.tgz
@shmidt
shmidt / secure_pi.sh
Last active September 30, 2020 07:41
Securing Pi
# https://www.raspberrypi.org/documentation/configuration/security.md
sudo apt install ufw
sudo ufw allow ssh
sudo ufw limit ssh/tcp
sudo ufw enable
sudo apt install fail2ban
sudo service fail2ban restart
@shmidt
shmidt / forEachBatch.swift
Last active March 21, 2019 21:43
For loop using batches
import Foundation
public extension Array {
/**
Loops through array by batches
- Parameter batchSize: Size of the batch
- batch: Current batch elements
- currentNo: Current batch number