Skip to content

Instantly share code, notes, and snippets.

View patsbin's full-sized avatar

Patrick Willms patsbin

View GitHub Profile
@patsbin
patsbin / gist:868c48c5e8b3de1ccad7dd19257f7a17
Created March 3, 2022 15:10
Keychain Error: Problem adding; giving up
Getting an error after migrating to a new system when adding private keys to ssh-agent
/usr/bin/keychain -q --nogui $HOME/.ssh/id_rsa.key
* Error: Problem adding; giving up
Manually adding the key shows a permission problem
ssh-add ~/.ssh/id_rsa.key
chmod 700 /home/pwi/.ssh/*.key
In .bashrc
location /websocket/ {
rewrite ^/websocket/(.*)$ /$1 break;
proxy_pass $websocket;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@patsbin
patsbin / CompareFolders.ps1
Created January 30, 2019 07:12
Compare and copy files in directories
<#
.SYNOPSIS
Compare and copy files in directories
.DESCRIPTION
Compared files in folder a (leftdir) to files in folder b (rightdir).
If the file is not in folder b and a third directory is defined, the file will be copied there.
See Get-Help .\CompareFolders.ps1 -Examples
.EXAMPLE
@patsbin
patsbin / gist:cacb3199e5331c1e8a2e61468ef4e86b
Last active January 30, 2019 07:10
HTML/CSS spinning loader
.loader {
left: 50%;
top: 50%;
position: fixed;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%); }
.loader #spinner {
box-sizing: border-box;
stroke: #673AB7;
stroke-width: 3px;
@patsbin
patsbin / gist:f3bb136f620fd5e3d8fc78f65a9d1dda
Last active September 11, 2018 08:43
Separation of really simple configuration in python
#config.py
CONFIG = {
'key1': 'value1',
'key2': 'value2'
}
#script.py
import config
print config.CONFIG['key1']
@patsbin
patsbin / gist:fd4faae1222e3e94418c377eda774b77
Created September 5, 2018 18:00
append text to file with root privileges
sudo tee -a file > /dev/null << EOF
text to add at bottom
EOF
@patsbin
patsbin / gist:b81ca21f80ec7e7f9c90
Created October 9, 2015 09:53
Reactivate external monitor (e.g. via ssh after monitor switch)
DISPLAY=:0 xrandr --auto
@patsbin
patsbin / gist:332805afce6bd7a1e540
Created July 17, 2014 09:51
Windows Backup mit robocopy und Wochentagen als Ordnernamen
@echo off
for /f "tokens=2" %%i in ('robocopy /?^|find "Gestartet"') do (
if "%%i" == "Mon" set "WoTag=Montag"
if "%%i" == "Tue" set "WoTag=Dienstag"
if "%%i" == "Wed" set "WoTag=Mittwoch"
if "%%i" == "Thu" set "WoTag=Donnerstag"
if "%%i" == "Fri" set "WoTag=Freitag"
if "%%i" == "Sat" set "WoTag=Samstag"
if "%%i" == "Sun" set "WoTag=Sonntag"
)
@patsbin
patsbin / gist:4bcef9206de2f660304a
Created July 17, 2014 06:19
System-Backup using Windows Server systemtools
@echo off
net use \\BACKUP Passw0rd /user:backup_user
C:\Windows\System32\wbadmin.exe start backup -backupTarget:\\BACKUP\Sicherung -allCritical -vssFull -systemState -quiet