Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
ENV['RAILS_ENV'] ||= "production"
require 'rubygems'
require 'ansi_colors'
require './config/environment'
#user = User.find_by_username("mrzyx")
#handles = user.contacts.collect { |c| c.person.diaspora_handle }
handles = Person.all.collect { |person| person.diaspora_handle }
@jhass
jhass / 1-README.md
Last active November 5, 2015 00:58
ix.io helper function
  1. Add to your .${SHELL}rc.
  2. Replace user and password.
  3. Create cat foo | ixio.
  4. Update cat foo | ixio abc.
  5. View your pastes at ix.io/user/your_username.
@jhass
jhass / lib_c.cr
Last active November 12, 2015 19:54
Platform indepedent standard library for Crystal
lib LibC
# Common bindings go here
fun chdir(...)
fun printf(...)
fun wprintf(...)
fun atoi(...)
fun watoic(...)
end
ifdef windows
@jhass
jhass / archlinux.sh
Created November 18, 2015 23:30
VMM (http://vmm.localdomain.org/) DKIM configuration (only relevant parts shown)
sudo pacman -S opendkim
sudo cp /etc/opendkim/opendkim.conf{.sample,}
sudo mkdir /var/lib/dkim
sudo chown opendkim:mail /etc/opendkim/opendkim.conf /var/lib/dkim
sudo chmod 700 /var/lib/dkim
sudo chgrp mail /var/spool/postfix/private
sudo -u opendkim opendkim-genkey -D /var/lib/dkim -b 2048 -s mail
sudo usermod -a -G mail postfix
@jhass
jhass / me@mrzyx.de.asc.txt
Last active December 10, 2015 11:49
PGP key
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.22 (GNU/Linux)
mQENBE7I+ZUBCAC1zez5X2Y4zFbslYAobm4VX3jxV9gfAmN8rF6CM4cvGzcuy4+a
woRDXXu016QH3v/pnSSn9neWGNm4HULNiAl3gxIjhBvZcyiVV5eiDQaxLENZrjYb
BW0YtseVwWBmwD3mEyA7eRz81rzgldvUbQmh9DEEl0ZJf8tsQWGrQQB7g10bdRVp
X2P/KSYsoodDEiF+XDfSPKrzAZoqxa/mSZFCQeyThsvSyTa8baSvDA5iHm/p4MPn
Pa0Aki6QYLgYkGo5wFbrPENV7wToMiNOzg21mYdKouaijAC592CqWi1XSQE8nIEq
NppX+uI2jazH3EqFNviuyFKyw9fGYInHYHWrABEBAAG0GEpvbm5lIEhhw58gPG1l
QG1yenl4LmRlPohGBBARAgAGBQJQ42hSAAoJEOpqsNjng4LhbX8An1qLlq1b/5uA
@jhass
jhass / sidekiq.rake
Last active December 14, 2015 07:29
Sidekiq stats printer
require 'sidekiq/api'
namespace :sidekiq do
def print_stats
stats = Sidekiq::Stats.new
[:processed, :failed, :enqueued, :scheduled_size, :retry_size].each do |stat|
puts "sidekiq.#{stat} #{stats.send(stat)}"
end
puts "sidekiq.busy #{Sidekiq.redis { |con| con.scard("workers") }}"
end
@jhass
jhass / scan_pods_for_ssl.rb
Last active January 4, 2016 18:09
Quick'n' dirty script for checking status on SSL deployment in the diaspora* network
#!/usr/bin/env ruby
# Run from Diaspora root
# Requires https://github.com/DinoTools/sslscan/ (this fork) (https://aur.archlinux.org/packages/sslscan-git/)
class Scanner
def initialize host, statistics
@host = host
@statistics = statistics
run
end
@jhass
jhass / injecting_io.cr
Last active March 30, 2017 07:29
Crystal injecting/replacing IO PoC
struct Slice(T)
def []?(start, count)
if start + count >= size
count = -1
end
if count < 0
count = size - start + (count + 1)
end
@jhass
jhass / .gitignore
Last active June 5, 2017 11:27
bxctl - Small helper to manage my boxcars configuration
/.crystal/
/bxctl
/pkg/
/src/
*.tar.xz
@jhass
jhass / hockeyapp_updater.rb
Last active June 9, 2017 08:20
Update all connected devices and running emulators with the latest version of your app(s) from HockeyApp (install Ruby & bundler first)
#!/usr/bin/ruby
require "bundler/inline"
gemfile(ARGV.any? {|arg| arg == "--install"}) do
source "https://rubygems.org"
gem "http", "~> 2.2"
gem "ADB", "~> 0.5.6"
gem "slop", "~> 4.5"
end