Skip to content

Instantly share code, notes, and snippets.

@josqu4red
josqu4red / feeds.rb
Created March 4, 2014 10:27
Parse Atom feeds and display only entries from less than <delta> days ago. Useful for tracking software updates
#!/usr/bin/env ruby
require "rss"
require "yaml"
require "getoptlong"
opts = GetoptLong.new(
[ '--feeds', '-f', GetoptLong::REQUIRED_ARGUMENT ],
[ '--delta', '-d', GetoptLong::REQUIRED_ARGUMENT ],
)
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {
@josqu4red
josqu4red / rer.rb
Last active December 29, 2015 08:49
Retrieve Paris RER A/B schedule from your terminal
require 'uri'
require 'net/http'
require 'net/https'
require 'nokogiri'
def get_stations(line)
uri = URI("http://www.ratp.fr/horaires/fr/ratp/rer/choix-arret-direction/#{line}")
response = Net::HTTP.get_response(uri)
if response.is_a? Net::HTTPSuccess
doc = Nokogiri::HTML(response.body)
@josqu4red
josqu4red / soas.sql
Last active December 26, 2015 19:58
Sqlite triggers to bump Powerdns zone serial on insert/update/delete of record
-- SOAs table since split in sqlite is tricky
CREATE TABLE soas (
id INTEGER PRIMARY KEY,
domain_id INTEGER NOT NULL,
mname VARCHAR(255) NOT NULL COLLATE NOCASE,
rname VARCHAR(255) NOT NULL COLLATE NOCASE,
serial INTEGER NOT NULL,
refresh INTEGER NOT NULL,
retry INTEGER NOT NULL,
expiry INTEGER NOT NULL,
@josqu4red
josqu4red / haproxy_debian.sh
Last active December 25, 2015 13:09
Haproxy multi instance initscripts, FreeBSD & Debian
#!/bin/sh
### BEGIN INIT INFO
# Provides: haproxy
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: fast and reliable load balancing reverse proxy
# Description: This file should be used to start and stop haproxy.
### END INIT INFO