Skip to content

Instantly share code, notes, and snippets.

@Marc-Bender
Marc-Bender / AVRDragonFWUpdateCheatSheet.txt
Created February 4, 2023 13:03
AVRDragon Firmware Update (fix when misbehaving)
c:\Program Files (x86)\Atmel\Studio\7.0\atbackend>atfw -t avrdragon -a ..\tools\AVRDragon\dragon_fw.zip
Found avrdragon:00A200004447
Upgrading avrdragon:00A200004447
Upgrading Main MCU: [==========]
Upgrading Slave MCU: [==========]
Successful upgrade
@Marc-Bender
Marc-Bender / .vimrc
Last active August 26, 2020 20:18
Vimrc
set nu rnu nocompatible incsearch ignorecase title foldcolumn=4
inoremap <C-A> <C-O>gg<C-O>V<C-O>G
nnoremap <C-A> ggVG
inoremap <C-BS> <C-W>
vnoremap <silent> <Leader>s :sort<CR>
nnoremap <silent> WW :wa <Enter>
nnoremap <F2>L :source ~/.vimrc-latex<CR>
nnoremap <F2>C :source ~/.vimrc-C<CR>
nnoremap <F2>UC :source ~/.vimrc-unmapC<CR>
nnoremap <F2>UL :source ~/.vimrc-unmapLatex<CR>
@Marc-Bender
Marc-Bender / nasMnt
Last active July 24, 2020 20:50
Mounting script for nfs mounting various shares on my NAS
#! /bin/bash
address=$(sudo arp-scan -I enp5s0 -localnet | grep "Synology" | awk '{print $1'})
choice=$(echo -e "Filme\nMusik\nUnsortierte Musik" | dmenu -i -p "Which NAS share to mount?")
if [ "$choice" == "Filme" ]; then
volume=2
else
volume=1
fi
if [ $(df 2> /dev/null | grep --count "$choice") -ne 0 ]; then
sudo umount "/mnt/nas/$choice"
@Marc-Bender
Marc-Bender / makeRamdiskOfSize
Last active July 19, 2022 12:26
Shell script to make a RAM disk of a certain size on Linux systems. Designed to replace my previous C-Solution. This solution now sanitizes inputs and comes with a manpage
#! /bin/sh
if [ "$#" -ne 1 ]
then
echo Exactly one argument must be given
else
if df | grep '/mnt/ramdisk' > /dev/null
then
echo Already mounted a RAM-disk...
elif [ `grep 'MemFree' /proc/meminfo | grep -o [0-9]*` -lt `numfmt --from=iec $1 --to-unit=1024` ]
@Marc-Bender
Marc-Bender / convM4AOGG.sh
Last active July 24, 2020 20:51
Shellscript to convert M4A and OGG files to mp3
find . -type f -name '*.m4a' -exec bash -c 'ffmpeg -i "$0" -c:a libmp3lame -q:a 2 "$0.mp3" && rm "$0"' '{}' \;& find . -type f -name '*.ogg' -exec bash -c 'ffmpeg -i "$0" -c:a libmp3lame -q:a 2 "$0.mp3" && rm "$0"' '{}' \;
@Marc-Bender
Marc-Bender / make_ramdisk_ofSize.c
Last active March 30, 2020 17:10
[DEPRECATED] C Programm that creates a RAM-Disk of variable size using shell commands (linux only)
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define __CMD__ "sudo mount -t tmpfs tmpfs /mnt/ramdisk/ -o size="
int main(const int argc, const char * argv[])
{
if(argc != 2)
{
@Marc-Bender
Marc-Bender / install-what-i-want.sh
Last active July 14, 2019 22:20
Installes the programms that I always install on my machines (manually until now)
# this is for the plain installing side of things
apt update -y
apt install synaptic openssh-server filezilla vlc htop texmaker texlive* gparted neofetch -y
apt autoremove -y
#this is to add the string 'neofetch' to the end of Xprofile...
echo neofetch >> /tmp/neofetch.tmp
cat ~/.Xprofile neofetch.tmp >> ~/.Xprofile.new
rm /tmp/neofetch.tmp
rm ~/.Xprofile
@Marc-Bender
Marc-Bender / uninstall-bloat.sh
Created June 5, 2019 19:38
Debloates Xubuntu (18.04) by removing programs that are install per default and that I never use
apt remove pidgin pidgin-data pidgin-libnotify pidgin-otr gnome-mines orage sgt-puzzles parole gnome-sudoku thunderbird thunderbird-locale-de thunderbird-locale-en thunderbird-locale-en-gb thunderbird-locale-en-us xfburn xfce4-dict xfce4-notes xfce4-notes-plugin gnome-accessibility-themes libgail-common libgail18 -y
apt autoremove -y