Skip to content

Instantly share code, notes, and snippets.

View nogweii's full-sized avatar
🍀

Nogweii nogweii

🍀
View GitHub Profile
#!/usr/bin/ruby
# Ruby version of dspam-retrain perl script.
# Perl version: http://dspamwiki.expass.de/DspamRetrainScript
# Author: wsr@rushforthnetworks.com
# License: BSD
# Abstract: setup postfix to pipe mail into this script
# so that we may then pass it off to dspam in
# an appropriate way.
#
# dspam-retrain.rb handles spam-user@domain.tld, and
@netj
netj / memusg
Last active January 29, 2024 15:04
memusg -- Measure memory usage of processes
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2010-08-16
############################################################################
# Copyright 2010 Jaeho Shin. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
@bryanl
bryanl / tmux.conf
Created November 30, 2010 05:17
I copied this from somewhere. It is a good start, though
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@kenstir
kenstir / strophe.xdomainrequest.js
Created July 20, 2011 20:20 — forked from iadvize/strophe.xdomainrequest.js
A Strophe plugin by iAdvize that use the XdomainRequest if found (Internet Explorer)
Strophe.addConnectionPlugin("xdomainrequest", {
init: function () {
if (window.XDomainRequest) {
Strophe.debug("using XdomainRequest for IE");
// override the send method to fire readystate 2
if (typeof XDomainRequest.prototype.oldsend == 'undefined') {
XDomainRequest.prototype.oldsend = XDomainRequest.prototype.send;
XDomainRequest.prototype.send = function() {
XDomainRequest.prototype.oldsend.apply(this, arguments);
@acdimalev
acdimalev / gem-depcheck
Created August 4, 2011 10:51
Check for uninstalled gem dependencies.
#!/usr/bin/ruby
require 'rubygems'
installed_gems = Gem::Dependency.new '', Gem::Requirement.default
missing = []
# mind the short-hand, looping over installed gem specs
specs = Gem.source_index.search installed_gems
specs.each do |spec|
gem = Gem::Dependency.new spec.name, spec.version
# looping over gem dependencies
specs = Gem.source_index.search gem
@tsudot
tsudot / mod_jinglerelaynodes.lua
Created August 6, 2011 19:47
Jingle Relay Nodes implementation in Prosody.
local st = require "util.stanza";
local host = module:get_host();
local stun_ip = module:get_option('stun_ip');
local stun_port = module:get_option_number('stun_port');
local uuid = require "util.uuid";
module:add_feature('http://jabber.org/protocol/jinglenodes');
module:hook('iq-get/host/http://jabber.org/protocol/jinglenodes', function(event)
local session, stanza = event.origin, event.stanza;
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

require "uri"
(URI::REGEXP.constants - ["PATTERN"]).each do |rc|
puts "#{rc}: #{URI::REGEXP.const_get(rc)}"
end
URI::REGEXP::PATTERN.constants.each do |pc|
puts "#{pc}: #{URI::REGEXP::PATTERN.const_get(pc)}"
end
@peterc
peterc / dnsd.rb
Created December 2, 2011 23:47
Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# By Peter Cooper
#
# MIT license
#
# * Not advised to use in your production environment! ;-)
# * Requires Ruby 1.9
# * Supports A and CNAME records
# * See http://www.ietf.org/rfc/rfc1035.txt for protocol guidance
# * All records get the same TTL