Skip to content

Instantly share code, notes, and snippets.

View gregorydickson's full-sized avatar

Gregory Dickson gregorydickson

  • Oklahoma City
View GitHub Profile
@gregorydickson
gregorydickson / sieve.py
Last active February 5, 2024 01:29
Python Sieve of Eratosthenes
def count_primes(num):
list = [True for i in range(num+1)]
p = 2
while p*p <= num:
if list[p] == True:
for i in range(p*p, num+1, p):
list[i] = False
p += 1
return list.count(True) - 2
import latambuses.*
import org.quartz.JobExecutionContext
import groovyx.gpars.GParsPool
import groovy.time.TimeCategory
import cl.pullman.websales.to.CiudadTO
import cl.pullman.websales.to.EmpresaTO
import cl.pullman.websales.to.ServicioTO
import cl.pullman.websales.to.TarifaTO
List results = criteria.listDistinct () {
createAlias('samples','s',CriteriaSpecification.LEFT_JOIN)
createAlias('s.sampleRequests', 'sr', CriteriaSpecification.LEFT_JOIN)
or {
isNull('s.id')
sizeEq('s.sampleRequests', 0)
//Needs to be any samples available, not all samples available.
// In other words check all items in the collection and if they all meet
// the condition then exclude
import {bindable, inject,bindingMode, customElement} from 'aurelia-framework';
// Import JSPM modules we installed earlier
import $ from 'jquery';
import 'select2';
@customElement('form-select') // Define the name of our custom element
@inject(Element) // Inject the instance of this element
export class CustomSelect {
@gregorydickson
gregorydickson / 05-java-7-oraclejdk.config
Created October 26, 2016 22:27
Elastic Beanstalk / Java deployment -- Installing Oracle Java 7 via .ebextensions in your WAR file. This file should be in the src/main/webapp/.ebextensions directory of your WAR file, and Elastic Beanstalk will deploy Oracle Java 7 during configuration of the running node. The file is prefixed with "05-" to control the execution order of these …
commands:
00_download_jdk7:
command: wget --no-cookies --no-check-certificate --header "Cookie:gpw_e24=xxx" "http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-linux-x64.rpm" -O /etc/tomcat7/jdk7-oracle.rpm
test: test ! -f /etc/tomcat7/oracle-jdk7-installed.txt
01_install_oracle_jdk7:
command: yum -y install jdk7-oracle.rpm
cwd: /etc/tomcat7
test: test ! -f /etc/tomcat7/oracle-jdk7-installed.txt
@gregorydickson
gregorydickson / SmallNettyServer.groovy
Created May 18, 2016 18:10 — forked from itzg/SmallNettyServer.groovy
Just enough Groovy code to implement a GET'able HTTP server with regex based path routing.
import org.jboss.netty.bootstrap.ServerBootstrap
import org.jboss.netty.buffer.ChannelBuffers
import org.jboss.netty.channel.ChannelHandlerContext
import org.jboss.netty.channel.ChannelPipeline
import org.jboss.netty.channel.ChannelPipelineFactory
import org.jboss.netty.channel.Channels
import org.jboss.netty.channel.MessageEvent
import org.jboss.netty.channel.SimpleChannelUpstreamHandler
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory
import org.jboss.netty.handler.codec.http.DefaultHttpResponse

0. Overview

This article aims to be a portal to installation and configuration of Cassandra. It is self-contained in the first place. It also provides links to the original articles.

Warning: This article is still under written.

Prerequisites

Install Oracle Java Development Kit (JDK)

import java.util.ArrayList
def flatten
flatten = { list ->
switch(list){
case list.size() == 0:
return
break
case {list.head() instanceof Integer && list.size() == 1}:
result = list