Skip to content

Instantly share code, notes, and snippets.

View oneyb's full-sized avatar

Brian O. oneyb

  • Zurich
View GitHub Profile

Sync stuff automatically once it’s plugged in

This strategy worked for me: https://www.pcsuggest.com/run-shell-scripts-from-udev-rules/

The contents of /etc/udev/rules.d/phone-plugin.rules follow.

# The following is killed as the documentation explains about `RUN'
# ACTION=="add",ATTRS{idVendor}=="04e8",ATTRS{idProduct}=="6860",RUN+="/bin/su oney -c /home/oney/bin/.sync_phone.sh | at now"
# The service activated is a USER service, so the following doesn't work
# ACTION=="add",ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860",TAG+="systemd",ENV{SYSTEMD_WANTS}="sync-phone.service" 
# The following rule works just right :)

Remote access via tor

One can access a remote private server through tor. That is, tor is the bridge connecting you to remote server.

Set up tor hidden service on remote computer to be accessed

echo -e "HiddenServiceDir /var/lib/tor/ssh/\nHiddenServicePort 22 127.0.0.1:22" \
                     | sudo tee -a /etc/tor/torrc 
sudo systemctl start tor
sudo systemctl enable tor
#!/usr/bin/env bash
# I can't stand online photo albums that don't have a proper export mechanism
# Here is my solution for Shutterfly's shitty export mechanism.
# I hope this helps someone
if [[ -z $(which pdfcrop) ]]; then exit "Please install texlive for pdfcrop"; fi
if [[ -z $(which pdftk) ]]; then exit "Please install pdftk"; fi
@oneyb
oneyb / .configure-syncthing.yaml
Last active July 24, 2018 09:19
A nice little playbook to get ansible to set up syncthing for oneself on an SSH-accessible computer. Depends on @classicsc's nice python module: https://github.com/classicsc/syncthingmanager. Thanks alot!
---
- hosts: all
# run this: ansible-playbook -i lil_box.local, -u $USER .configure-syncthing.yaml --ask-become-pass
# beforehand you need to:
# ssh-copy-id -i $remoteserver
# as well as:
# ssh-copy-id -i localhost
vars:
sync_dir: "{{ ansible_env.HOME }}/Sync"
---
# run this: ansible-playbook -i localhost, -u $USER install-kanboard.yaml --ask-become-pass
- hosts: all
vars:
version: 1.2.5
tasks:
- name: install necessary packages
apt: pkg={{ item }} update_cache=yes cache_valid_time=86400
become: yes