Skip to content

Instantly share code, notes, and snippets.

@tfl
tfl / transfer_davical_data.rb
Created January 3, 2019 18:55
Ruby script to transfer Davical ics and vcf data from database to database. Maybe usefull if standard migration procedures fail
##########################################################################
# If all davical updates failed: create a new instance on your new system
# and transfer your data with this script and curl from your old server
# to your new server. The example below does this with your calendar data.
# Change URL, caldav_type and file extension and you can transfer your
# vcards as well. I did this a few days ago and it worked very well.
##########################################################################
require 'pg'
@tfl
tfl / functions.diif
Created January 3, 2019 15:57
Untested fix fpr phppgadmin-dev (v7...) which fixes an error where the function tree did not open
diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php
index ee19990f..e823fa7b 100755
--- a/classes/database/Postgres.php
+++ b/classes/database/Postgres.php
@@ -4184,8 +4184,7 @@ class Postgres extends ADODB_base {
INNER JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
INNER JOIN pg_catalog.pg_language pl ON pl.oid = p.prolang
LEFT JOIN pg_catalog.pg_user u ON u.usesysid = p.proowner
- WHERE NOT p.proisagg
- AND {$where}
@tfl
tfl / mediathekview-arte-tv.rb
Created October 25, 2016 18:11
Example for querying Arte.tv mediathek in Ruby
require 'json'
require 'net/http'
# %s gets replaced with yyyy-mm-dd/yyyy-mm-dd
URL = "http://www.arte.tv/papi/tvguide/epg/schedule/D/L3/%s/%s.json"
####
## lets get started
####
@tfl
tfl / mediathekview-3sat-de.rb
Created October 25, 2016 18:03
Example for querying 3sat.de mediathek in Ruby - did not get HD material though
require 'nokogiri'
require 'open-uri'
# 3SAT mediathek URL
base_uri = "http://www.3sat.de/mediathek"
# 3SAT rss feed url
rss_feed = "#{base_uri}/rss/mediathek.xml"
# 3SAT webservice
@tfl
tfl / gist:8851266
Last active August 29, 2015 13:56
CB1000R Cleanup
// ==UserScript==
// @name CB1000R
// @namespace NS
// @description CB1000R Forum
// @include http://cb1000r-freunde.de/*
// @version 1
// @grant none
// ==/UserScript==
// header
@tfl
tfl / gist:5821496
Created June 20, 2013 09:36
Elevate.exe is a small win32 console utility for Windows Vista or Windows 7/8 to help start other utilities with elevated rights but without having to start them from a batchfile
/*
*
* Torsten Flammiger, 2012
* (C) AS IS
*
*/
#include "stdafx.h"
#include "windows.h"
#include <iostream>
@tfl
tfl / gist:5314901
Created April 4, 2013 22:22
a simple capistrano recipe to use with sinatra
set :user, "root"
set :use_sudo, false
set :scm, :git
set :repository, 'file://path/to/your/local/repo'
set :config_dir, '<your webserver has to read this dir>'
set :deploy_to, '<the webroot of your sinatra application>'
set :deploy_via, :copy
set :copy_exclude, [".git", ".gitignore", "config", "Gemfile"]
@tfl
tfl / will_paginate_sinatra_renderer.rb
Created March 4, 2012 09:56
Using will_paginate with Sinatra and Twitter Bootstrap
# make sure to include the needed pagination modules
require 'will_paginate'
require 'will_paginate/view_helpers/sinatra'
module WillPaginate
module Sinatra
module Helpers
include ViewHelpers
def will_paginate(collection, options = {})
@tfl
tfl / rethinkingsphinx.rb
Created July 2, 2011 16:11
A very simple Ruby class using mysql fulltext indexes
class ReThinkingSphinx
QUERIES = {
:Post => {
:default => "SELECT * FROM posts WHERE MATCH (title, body) AGAINST (?)",
:boolean => "SELECT * FROM posts WHERE MATCH (title, body) AGAINST (? IN BOOLEAN MODE)"
},
:Event => {
:default => "SELECT * FROM events WHERE MATCH (name, description) AGAINST (?)",
:boolean => "SELECT * FROM events WHERE MATCH (name, description) AGAINST (? IN BOOLEAN MODE)"
},
@tfl
tfl / regtest.cs
Created October 21, 2010 14:25
Compile and run it as scheduled task - it fails here! It does not fail when run logged on.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
using System.IO;
using System.Security.Principal;
namespace regtest
{
class Program