Skip to content

Instantly share code, notes, and snippets.

Avatar

Casper Bruun bmcbm

View GitHub Profile
@bmcbm
bmcbm / reparer_ubuntu.md
Created Jan 12, 2021
Reparer Ubuntu på LUKS krypteret harddisk
View reparer_ubuntu.md

Reparer Ubuntu

Hvis Ubuntu ikke kan startes og fx blot efterlader opstarten i en (initramfs) prompt, kan disse skridt hjælpe med at reparere systemet.

I dette eksempel er systemet installeret på en 1TB M2 SSD (/dev/nvme0n1) med LUKS og LVM.

Live USB boot

Boot systemet på en Live CD/USB

View setup-nvdia-suspend.sh
# Use systemd for managing NVIDIA driver suspend in drivers ====>>> PRIOR to version 470 <<<=====
# https://download.nvidia.com/XFree86/Linux-x86_64/450.66/README/powermanagement.html
# https://forums.developer.nvidia.com/t/unable-to-set-nvidia-kernel-module-parameters/161306
# Please note: In Fedora Linux you may need to just install the xorg-x11-drv-nvidia-power pakage
# as sugested by @goombah88 in the comments below.
TMP_PATH=/var/tmp
TMPL_PATH=/usr/share/doc/nvidia-driver-460/
echo "options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=${TMP_PATH}" | sudo tee /etc/modprobe.d/nvidia-power-management.conf
@bmcbm
bmcbm / .bash_aliases
Last active Apr 4, 2018
# Timestamped, Git enabled Prompt
View .bash_aliases
#!/bin/bash
# Timestamped, Git enabled Prompt
export PS1='\[\e[01;30m\]\t\[\033[01;32m\] \u\[\e[0m\]@\[\e[01;95m\]\h\[\033[00m\]:\[\e[01;34m\]\w\[\e[00m\]`[[ $(git status 2> /dev/null) =~ Changes\ to\ be\ committed: ]] && echo "\[\e[38;5;202m\]" || echo "\[\e[31m\]"``[[ $(git status 2> /dev/null) =~ untracked\ files\ present ]] && echo "\[\e[33m\]"``[[ ! $(git status 2> /dev/null) =~ nothing\ to\ commit,\ working\ .+\ clean ]] || echo "\[\e[32m\]"`$(__git_ps1 "(%s)")\[\e[00m\]\$ '
@bmcbm
bmcbm / .emacs
Last active Jan 16, 2018
.emacs file
View .emacs
;; Sæt (netværks)printer sti
;(setq lpr-switches nil) ; Stop printing headers
;(setq printer-name "HPLJ6MP")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; start gnuserv stuff. Put it up front so you don't get into a
;; timeout problem when starting emacs from gnuclient or gnudoit,
;; according to Cristian Ionescu-Idbohrn
@bmcbm
bmcbm / gnome3-unity-settings.sh
Last active Nov 25, 2020
Gnome3 Unity settings
View gnome3-unity-settings.sh
#!/bin/bash
# Add date and weekeday to clock to Gnome Shell
gsettings set org.gnome.desktop.interface clock-show-date true
gsettings set org.gnome.desktop.interface clock-show-weekday true
# Move window control buttons to the left, Unity Style
gsettings set org.gnome.desktop.wm.preferences button-layout close,minimize,maximize:
# Move show application button from bottom of dash to top
@bmcbm
bmcbm / .bash_aliases
Last active Feb 1, 2018
Add scp and snapshot (ie. shorthand for vboxmanage snapshot) to vagrant command
View .bash_aliases
#!/bin/bash
function vagrant() {
if [ -x /usr/bin/vagrant ] ; then
if [ "$1" = 'scp' ]; then
# Inspired by https://gist.github.com/colindean/5213685
TMPFILE=$(mktemp)
HOST=$( echo "${@: -1}" | cut -d: -f1)
/usr/bin/vagrant ssh-config $HOST > $TMPFILE
if [ $? -eq 0 ] ; then