Skip to content

Instantly share code, notes, and snippets.

sebastian krämer dotob

Block or report user

Report or block dotob

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
View sedoneliners.txt
-------------------------------------------------------------------------
USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) Dec. 29, 2005
Compiled by Eric Pement - pemente[at]northpark[dot]edu version 5.5
Latest version of this file (in English) is usually at:
http://sed.sourceforge.net/sed1line.txt
http://www.pement.org/sed/sed1line.txt
This file will also available in other languages:
Chinese - http://sed.sourceforge.net/sed1line_zh-CN.html
@dotob
dotob / index.ts
Created Sep 16, 2016
express route per typescript decorator
View index.ts
import * as express from 'express';
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});
@dotob
dotob / checkmysql
Created May 16, 2016
small script to check if mysql is running and restart it if not
View checkmysql
echo "check mysql"
service mysql status | grep -qE [0-9]{5}
if [ $? -eq 0 ]; then
echo OK
else
service mysql start
echo "-" | mail -s "fringshaus.de mysql restarted" -r sk@dotob.de sk@dotob.de
echo "mysql restarted, mail sent"
fi
@dotob
dotob / nojquery_table_select.html
Created Feb 11, 2016
select rows and columns in html without jquery
View nojquery_table_select.html
<html>
<head>
<title>brand</title>
<style>
.selected {background-color: lightgrey;}
table {border:1px solid black;}
td {border:1px solid black;}
</style>
<script type="text/javascript">
// ready func for knowing when document is ready
@dotob
dotob / d3-server.coffee
Created Jan 6, 2016
Directly render and serve d3 visualizations from a nodejs server.
View d3-server.coffee
# Start `coffee d3-server.coffee`
# Then visit http://localhost:1337/
# originally from: https://gist.github.com/Caged/6407459
d3 = require('d3')
http = require('http')
jsdom = require('jsdom')
http.createServer((req, res) ->
# Chrome automatically sends a requests for favicons
# Looks like https://code.google.com/p/chromium/issues/detail?id=39402 isn't
@dotob
dotob / gist:4034731
Created Nov 7, 2012
teamcity sample artifact vs. buildinfo
View gist:4034731
private Uri CreateArtefactUri(Build build) {
string finalArtifactName = string.Empty;
try {
string artifactInfoUriString = string.Format("http://{0}/guestAuth/repository/download/{1}/{2}/teamcity-ivy.xml", this.teamCityHost, this.buildType, build.Number);
using (WebClient wc = new WebClient()) {
var artefactInfo = wc.DownloadString(artifactInfoUriString);
XDocument artifactInfoXmlDoc = XDocument.Parse(artefactInfo);
foreach (var artifactElement in artifactInfoXmlDoc.Element("ivy-module").Element("publications").Elements("artifact").Where(e => e.Attribute("ext").Value == "exe")) {
var artifactName = artifactElement.Attribute("name").Value;
if (Regex.IsMatch(artifactName, this.artifactNameMatch)) {
@dotob
dotob / transferhandler
Created Aug 15, 2012
filedragdrop handler
View transferhandler
// imports omitted, dont know why...
public class Foo extends TransferHandler {
//.../*DRAG &amp;amp; DROP*/
@Override
public boolean importData(JComponent comp, Transferable t) {
// Make sure we have the right starting points
if (!(comp instanceof JTextField)) {
return false;
}
@dotob
dotob / rss2uli.rb
Created Jun 12, 2012
rss parsing with ruby and simplerss
View rss2uli.rb
require 'simple-rss'
require 'open-uri'
class RssReader
def parseFeed (url, length)
feed_url = url
result = SimpleRSS.parse open(feed_url)
output = "<html><meta charset=\"utf-8\"><body>";
output += "<h1>#{result.channel.title}</h1><br />"
result.items.each_with_index do |item, i|
You can’t perform that action at this time.