Skip to content

Instantly share code, notes, and snippets.

View omnisis's full-sized avatar

Clifford James omnisis

View GitHub Profile
@omnisis
omnisis / goodies.py
Last active August 29, 2015 13:55
Pandas / Matplotlib Goodies
# Creating a new plot with no spacing
fig, axes = plt.subplots(2, 2, sharex=True, sharey=True) for i in range(2):
for j in range(2):
axes[i, j].hist(randn(500), bins=50, color='k', alpha=0.5)
plt.subplots_adjust(wspace=0, hspace=0)
# useful bar graph
series.value_counts().plot(kind='bar/barh')
@omnisis
omnisis / gist:9755326
Created March 25, 2014 04:32
Start Jetty SSL with HTTP redirect
package com.nextinstruction;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.webapp.WebAppContext;
@omnisis
omnisis / *ensime-events*
Created January 24, 2015 03:25
Ensime Issues
(:swank-rpc
(swank:connection-info)
1)
(:return
(:ok
(:pid nil :implementation
(:name "ENSIME-ReferenceServer")
:version "0.8.10"))
1)
(:swank-rpc
package tutorial.storm
import backtype.storm.utils.Utils
import backtype.storm.{LocalCluster, StormSubmitter, Config}
import backtype.storm.generated.StormTopology
import com.typesafe.scalalogging.slf4j.LazyLogging
import org.rogach.scallop._
class RunnerOptions(arguments: Seq[String]) extends ScallopConf(arguments) {
#!/bin/sh
remove_dangling() {
echo "Removing dangling images ..."
docker rmi $(docker images -f dangling=true -q)
}
remove_stopped_containers() {
echo "Removing stopped containers ..."
docker rm $(docker ps -qa)
@omnisis
omnisis / groovy_xml.groovy
Created October 19, 2010 00:41
XML examples in Groovy
class XmlExamples {
static def CAR_RECORDS = '''
<records>
<car name='HSV Maloo' make='Holden' year='2006'>
<country>Australia</country>
<record type='speed'>Production Pickup Truck with speed of 271kph</record>
</car>
<car name='P50' make='Peel' year='1962'>
<country>Isle of Man</country>
<record type='size'>Smallest Street-Legal Car at 99cm wide and 59 kg in weight</record>
@omnisis
omnisis / gist:1233705
Created September 22, 2011 00:14
TYCHO POM.xml with aspects copied deps
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2011, EclipseSource and others All rights reserved. This
program and the accompanying materials are made available under the terms
of the Eclipse Public License v1.0 which accompanies this distribution, and
is available at http://www.eclipse.org/legal/epl-v10.html -->
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
@omnisis
omnisis / gist:1233759
Created September 22, 2011 00:49
TYCHO POM.xml with aspects failing compile
=================
pom.xml
=================
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2011, EclipseSource and others All rights reserved. This
program and the accompanying materials are made available under the terms
of the Eclipse Public License v1.0 which accompanies this distribution, and
is available at http://www.eclipse.org/legal/epl-v10.html -->
@omnisis
omnisis / StrategyRunner.groovy
Created January 13, 2012 03:06
An example of using interfaces with flexible closures
class StrategyRunner {
Map strategyMap = [:]
interface IStrategy {
boolean apply(arg)
};
def addStrategy(String name, Closure cl) {
@omnisis
omnisis / gist:1614265
Created January 15, 2012 04:13
Example of How to create a SQL DSL in clojure (from Joy of Clojure)
(ns joy.sql
"SQL DSL example from chapter 1."
(:require [clojure.string :as str]))
(defn expand-expr [expr]
(if (coll? expr)
(if (= (first expr) `unquote) ;;#: Handle unsafe literals
"?"
(let [[op & args] expr]
(str "(" (str/join (str " " op " ") (map expand-expr args)) ")")))