Skip to content

Instantly share code, notes, and snippets.

@przemarbor
przemarbor / vagrant-debian.sh
Last active March 17, 2023 09:01 — forked from FrightenedFox/vagrant-debian.sh
Shell script for installation of Vagrant and VirtualBox (6.1!) on Debian (Bullseye)
# Install requirements
sudo apt update && sudo apt install -y build-essential gcc make perl dkms
# Install VirtualBox
mkdir ~/tempInstallationDir/
wget https://download.virtualbox.org/virtualbox/6.1.42/virtualbox-6.1_6.1.42-155177~Debian~bullseye_amd64.deb -O ~/tempInstallationDir/virtualbox-6.1_6.1.42-155177~Debian~bullseye_amd64.deb
sudo dpkg -i ~/tempInstallationDir/virtualbox-6.1_6.1.42-155177~Debian~bullseye_amd64.deb
sudo apt install -f -y
sudo /sbin/vboxconfig
rm -rf ~/tempInstallationDir/
@przemarbor
przemarbor / ntfsUUID.md
Last active August 30, 2022 18:07
Change UUID for ntfs partition from bash

Change UUID for ntfs partition from bash

Run:

    sudo umount /dec/sdc3
    sudo ntfslabel --new-serial=6F8ECB2C59114F1A /dev/sdc3  # where /dev/sdc3 is ntfs partition
@przemarbor
przemarbor / parrun.sh
Created March 22, 2022 21:26 — forked from precsim/parrun.sh
Bash xargs script to run parallel MATLAB and Octave jobs
#!/bin/bash
#
# Bash script using xargs to run Matlab and Octave jobs in parallel.
#
n_parruns=16 # Total number of runs.
n_parproc=3 # Number of simultaneous parallel processes.
# Define Matlab/Octave executable and main m-scipt file to run.
export runcmd='/mnt/c/Octave/Octave-4.2.1/bin/octave-cli.exe'
@przemarbor
przemarbor / emacs-color-themes.md
Last active May 25, 2021 08:22
Setting colors for Emacs GUI toolbar and menubar in KDE #emacs #color #menubar #emacs-theme

Setting colors for Emacs GUI toolbar and menubar in KDE

System Settings -> Application Style -> GNOME Application Style (GTK) -> GTK Themes -> Select a GTK3 Theme (set it to Breeze-Dark for example)

additionally there may be a need to adjust Icon Themes in order to make them visible with dark theme:

System Settings -> Application Style -> GNOME Application Style (GTK) -> GTK Themes -> Icon Themes (set it to the one you like)

@przemarbor
przemarbor / conda.md
Last active May 14, 2021 06:47
Prevent anaconda runs its default virtual environment in command line #anaconda #conda #venv #python
@przemarbor
przemarbor / multiple-ssh.md
Last active April 23, 2021 07:58
Multiple SSH keys for different accounts on Github or Gitlab #ssh #git #gitlab #github

Multiple SSH keys for different accounts on Github or Gitlab

source: https://coderwall.com/p/7smjkq/multiple-ssh-keys-for-different-accounts-on-github-or-gitlab

Sometimes you need more accounts than one for access to Github or Gitlab and similar tools. For example you can have one account for your projects at home and second account for your company.

  1. Case 1: Multiple accounts on Github Create SSH keys with different names

    $ ssh-keygen -t rsa -C "your_name@home_email.com"

When you see this message

@przemarbor
przemarbor / SysRq magic keys.md
Last active April 16, 2021 13:54 — forked from JPvRiel/SysRq magic keys.md
SysRq magic keys #linux

sysrq magic keys

This is useful for trying to recover from an unresponsive system. However, by default, Ubuntu disables the key to gain raw keyboard access.\

Sometimes part of the issue is that X/Wayland display servers have crashed due to bad graphics drivers and keyboard input isn't processed anymore, whereby changing to another console, e.g. ctrl + alt + F1 doesn't work. Since the default disables keyboard control, alt + sysrq + r, can't help salvage the situation. Hence the suggestion to at least enable system request raw keyboard control when trying to recover a system.

Ubuntu doesn't enable control of keyboard by default

Ubuntu 16.04 LTS default value:

@przemarbor
przemarbor / Linux keyboard shortcuts for rebooting.md
Last active January 2, 2025 20:07
Linux keyboard shortcut for shutting down (or rebooting) system immediately #linux #kde #power

Linux keyboard shortcuts for shutting down (or rebooting) system immediately

Alt + PrtSc + O  == Shutdown the system immediately
Alt + PrtSc + B  == Reboot the system immediately

Under graphical environments like Unity, Alt + SysRq takes a screenshot. You must hold down ctrl as well.

https://askubuntu.com/questions/53263/shut-down-computer-from-keyboard

@przemarbor
przemarbor / column_vector_in_numpy.md
Last active April 16, 2021 13:58
Slicing numpy arrays and preserving its (mathematical) shape #numpy #python #column_vector

Slicing numpy arrays and preserving its (mathematical) shape

Sometimes you need to slice a column from a numpy array and preserve its column shape, i.e. you want your vector to be an array of (m x 1) size. Numpy does not enable any straighforward way of doing it (slicing a vector from a matrix always gives a row vector, regardless you slice a row or a column). Here's a code that presents a bypass of this problem:

import numpy as np

def column(A,j):

@przemarbor
przemarbor / multiple-push-urls.md
Last active April 16, 2021 13:58 — forked from bjmiller121/multiple-push-urls.md
Add multiple push URLs to a single git remote #git

Add multiple push URLs to a single git remote

Sometimes you need to keep two upstreams in sync with eachother. For example, you might need to both push to your testing environment and your GitHub repo at the same time. In order to do this simultaneously in one git command, here's a little trick to add multiple push URLs to a single remote.

Once you have a remote set up for one of your upstreams, run these commands with:

git remote set-url --add --push [remote] [original repo URL]
git remote set-url --add --push [remote] [second repo URL]