Skip to content

Instantly share code, notes, and snippets.

View wernerb's full-sized avatar
🏠
Working from home

Werner Buck wernerb

🏠
Working from home
View GitHub Profile
@wernerb
wernerb / sync.sh
Last active September 4, 2023 18:02
Sync folder with Google Drive. Recursively downloads with wget and Google Drive public links. Used to sync ebooks to my eReaders (Kobo). Be warned that public links are dangerous as they could allow someone to download your files. Be sure to use this only in secure environments. This has been tested to be used in POSIX shells as well as in bash.
#!/bin/sh
#input sharelink here. Example: https://drive.google.com/folderview?id=0B1g-MbiD2F6vdtOT92b3MoerO&usp=sharing
SHARELINK="https://drive.google.com/folderview?id=idU&usp=sharing"
DESTINATION="/full/path/to/folder"
# Change following to false when you don't want to delete files when they are missing from google drive. This can
REMOVEFILES=true
# Begin code
@wernerb
wernerb / genssh.scala
Created July 15, 2014 15:46
Generate SSH public keypair from SSH RSA/DSA/EC private key in Scala
import java.io.{DataOutputStream, ByteArrayOutputStream, StringReader}
import java.security.interfaces.{ECPublicKey, DSAParams, DSAPublicKey, RSAPublicKey}
import java.security._
import java.security.spec.X509EncodedKeySpec
import org.apache.commons.codec.binary.Base64
import org.bouncycastle.openssl.{PEMKeyPair, PEMParser}
object genPubSSHKey {
/**
UEFI firmware (version UEFI Firmware (DEBUG) built at 20:27:27 on Mar 7 2021)
Board Rev: 0xD03114
RAM < 1GB: 0x00000000 (Size 0x3B400000)
VideoCore: 0x3B400000 (Size 0x04C00000)
Total RAM: 0x200000000
FD:
PhysicalBase: 0x0
VirtualBase: 0x0
Length: 0x1D0000
FD Variables:
$ cat ~/.sway.log | grep output.c
2018-11-30 12:42:54 - [sway/sway/config/output.c:114] Adding non-wildcard output config
2018-11-30 12:42:54 - [sway/sway/config/output.c:135] Config stored for output eDP-1 (enabled: -1) (-1x-1@-1.000000Hz position -1,-1 scale 2.000000 transform -1) (bg (null) (null)) (dpms 0)
2018-11-30 12:42:54 - [sway/sway/config/output.c:108] Merging on top of existing output config
2018-11-30 12:42:54 - [sway/sway/config/output.c:135] Config stored for output eDP-1 (enabled: -1) (-1x-1@-1.000000Hz position 5120,1440 scale 2.000000 transform -1) (bg (null) (null)) (dpms 0)
2018-11-30 12:42:54 - [sway/sway/config/output.c:114] Adding non-wildcard output config
2018-11-30 12:42:54 - [sway/sway/config/output.c:135] Config stored for output Lenovo Group Limited LT2252p Wide 6V8ABBP1 (enabled: -1) (-1x-1@-1.000000Hz position 5120,390 scale -1.000000 transform -1) (bg (null) (null)) (dpms 0)
2018-11-30 12:42:54 - [sway/sway/config/output.c:114] Adding non-wildcard output config
2018-11-30 12:42
2016/05/29 20:30:48 [INFO] Packer version: 0.10.1
2016/05/29 20:30:48 Packer Target OS/Arch: linux amd64
2016/05/29 20:30:48 Built with Go Version: go1.6.2
2016/05/29 20:30:48 Detected home directory from env var: /root
2016/05/29 20:30:48 Using internal plugin for googlecompute
2016/05/29 20:30:48 Using internal plugin for virtualbox-ovf
2016/05/29 20:30:48 Using internal plugin for file
2016/05/29 20:30:48 Using internal plugin for null
2016/05/29 20:30:48 Using internal plugin for parallels-iso
2016/05/29 20:30:48 Using internal plugin for qemu
@wernerb
wernerb / wbuck.zsh-theme
Last active February 12, 2016 20:56
Theme for ZSH based on bureau theme. 2 lines, features time and git status / branch.
# oh-my-zsh w-buck Bureau Theme
### CUSTOM
_COL="red"
_HR="(" #❯
_HL=")" #❮
_LEFT="%{$fg[$_COL]%}$_HR%{$reset_color%}"
_RIGHT="%{$fg[$_COL]%}$_HL%{$reset_color%}"
### NVM
@wernerb
wernerb / wgetmirror.sh
Last active December 27, 2015 23:29
Uses strictly wget and grep to mirror a remote HTTP location recursively. Deletes old files. Supports http auth and self-signed certificates. Strictly POSIX compliant so that it works in "dash" as well as in "bash". Handy to use on arm devices that need syncing but do not have rsync or ssh. Currently used to sync multiple kobo ereaders.
#!/bin/bash
################ CONFIG ###################
username="user"
#HTTP Auth username
password="password"
#HTTP Auth password
basedirname="/directory/to/Sync"
#CA certificate in PEM format
certificate="/directory/to/cert.crt"
#url = Set to the https server running an nginx or apache file listing. Make sure its urlencoded and don't forget trailing slash.
#!/bin/bash
while :
do
clear
git --no-pager log --graph --pretty=oneline --abbrev-commit --decorate --all $*
sleep 1
done
@wernerb
wernerb / wbuck.zsh-theme
Created December 18, 2014 11:01
Theme for oh-my-zsh.
# oh-my-zsh w-buck Bureau Theme
### CUSTOM
_COL="red"
_HR="(" #❯
_HL=")" #❮
_LEFT="%{$fg[$_COL]%}$_HR%{$reset_color%}"
_RIGHT="%{$fg[$_COL]%}$_HL%{$reset_color%}"
### NVM
---
clusters:
#Static website running nginx and displaying the
smallweb:
state:
provider: private
instance-template: small-centos-6.5
nodes: 3
dependencies: []
cluster-groups: []