Skip to content

Instantly share code, notes, and snippets.

Jonne Haß jhass

Block or report user

Report or block jhass

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jhass / .rubocop.yml
Last active Feb 16, 2020
My preferred Rubocop config
View .rubocop.yml
RunRailsCops: true
# Commonly used screens these days easily fit more than 80 characters.
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
jhass /
Last active Feb 11, 2020
Lock (Gnome) session when removing Yubico U2F key


  1. Copy 99-u2f_lock_screen.rules to /etc/udev/rules.d.
  2. Copy gnome_lock_all_sessions to /usr/local/bin.
  3. Mark gnome_lock_all_sessions as executable: chmod +x /usr/local/bin/gnome_lock_all_sessions
  4. Reload udev: udevadm control -R
jhass / nginx.conf
Last active Jan 3, 2020
Nginx Diaspora reverse proxy. - This is not a complete Nginx configuration! It only shows the relevant parts for integrating Diaspora.
View nginx.conf
# This is not a complete Nginx configuration! It only shows the relevant parts for integrating Diaspora.
# [...]
http {
# Your standard server configuration goes here
# [...]
gzip_static on;
jhass /
Last active Dec 31, 2019
My Ruby setup on Archlinux

Ruby on Archlinux

I thought I would document my setup, since it's somewhat non-standard but working quite well for me.

What this does

  • Install major Ruby versions at their latest patch release
  • Allow to switch between them seamlessly
  • Use chruby
  • Encourage bundler usage
jhass / diaspora.conf
Last active Oct 18, 2019
Advanced Diaspora Apache reverse proxy
View diaspora.conf
# Make sure to notice the comments at
<VirtualHost *:80>
RedirectPermanent /
<VirtualHost *:443>
jhass /
Last active Oct 17, 2019
Capture unix socket to pcap file with socat and tshark
# Parameters
# Extract repetition
source_socket="$(dirname "${socket}")/$(basename "${socket}").orig"
jhass /
Last active Aug 21, 2019 — forked from chitsaou/
Proxy to remote server with CORS support
View for mitmproxy

Hacking CORS restriction to enable in-browser XHR to any server.


Say you are running an web app at localhost, and you want to send XHR to http://remote-server:80, but the CORS restriction forbids access because you are sending requests from an origin that remote-server:80 does not allow.


jhass / .ssh_authorized_keys
Last active May 17, 2019
Git shell only for specific SSH key
View .ssh_authorized_keys
command="/home/USER/.ssh/git-shell",no-port-forwarding,no-X11-forwarding,no-pty ssh-rsa YOUR_KEY foo
jhass / diaspora_spam.rb
Last active Mar 27, 2019
Deletes spam comments, posts and local spam accounts. Place into Diasporas root, edit and run. Don't forget to set necessary environment variables.
View diaspora_spam.rb
#!/usr/bin/env ruby
# List of spam accounts
spam_accounts = %w(spamacc@podA spamacc@podB spamacc@mypod)
# Delete comments even if spammer isn't a local user or spam isn't on a
# local users account.
# And delete posts of users in spam_accounts that aren't local.
always_delete = true
jhass / barcode.html
Last active Feb 12, 2019
Simple Barcode generator
View barcode.html
<!DOCTYPE html>
<title>Barcode generator</title>
<script src=""></script>
<script src="" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<script type="text/javascript">
window.eanHistory = [];
function loadHistory() {
You can’t perform that action at this time.