Skip to content

Instantly share code, notes, and snippets.

[user]
name = granbom
email = pg@pgconsulting.se
[credential]
helper = cache --timeout=3600
[push]
default = simple
@granbom
granbom / rsync
Last active January 19, 2018 23:16
rsync -r -e "ssh" --progress ~/repos/granbom.se/_site/ cloud:/var/www/granbom/_site
server {
listen 80;
server_name example.com www.example.com;
access_log off;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl;
-o %(series)s.s%(season_number)02de%(episode_number)02d.%(title)s.%(height)sp-%(id)s.%(ext)s
-f 'bestvideo[height<=720]+bestaudio/best[height<=720]'
--restrict-filenames
dotnet publish -f netcoreapp2.0 -c Release
@granbom
granbom / shutdown
Created February 5, 2018 19:19
Shutdown Win 10 for real
C:\Windows\System32\shutdown.exe /s /t 0
@granbom
granbom / openssl IMAP connect
Created March 6, 2018 02:39
IMAP test with openssl
openssl s_client -crlf -connect example.com:993
tag login user@example.com password
tag LIST "" "*"
tag SELECT INBOX
tag STATUS INBOX (MESSAGES)
tag FETCH x:y (BODY[HEADER])
tag FETCH y (BODY)
tag FETCH y (BODY[n])
tag LOGOUT
run
control /name Microsoft.DefaultPrograms /page pageFileAssoc
@granbom
granbom / certbot
Last active June 14, 2018 02:47
certbot
certbot certonly --webroot -w /var/www/example/ -d www.example.com -d example.com
certbot certonly --webroot -w /var/www/example/ -d example.com -d www.example.com --post-hook="service nginx reload"
certbot certificates
# windows
certbot certonly --manual --preferred-challenges http -d example.com -d www.example.com
openssl pkcs12 -inkey privkey.pem -in cert.pem -in fullchain.pem -export -out example.pfx
@granbom
granbom / ffmpeg
Last active October 29, 2019 12:11
# to=timestamp
ffmpeg -i input -ss 00:01:00 -to 00:02:00 output
# t=duration
ffmpeg -i input -ss 00:01:00 -t 00:02:00 output
# concat
ffmpeg -i "concat:input1.ts|input2.ts|input3.ts" -c copy output.ts
# convert all files in dir from srt to vtt