Skip to content

Instantly share code, notes, and snippets.

View oluies's full-sized avatar

Örjan Angré (Lundberg) oluies

  • Sweden
  • 23:21 (UTC +02:00)
  • X @oluies
View GitHub Profile
@oluies
oluies / brews
Last active December 6, 2017 20:37
homebrews
% brew list | while read cask; do echo -n "$cask"; awk '{printf("brew install %s\n ", $0)}'; echo ""; done
% brew list | while read cask; do echo -n $fg[blue] $cask $fg[white]; brew deps $cask | awk '{printf(" %s ", $0)}'; echo ";done
brew install apache-spark
brew install argtable
brew install arpack
brew install autoconf
brew install autojump
brew install automake
brew install awscli
package se.cehis.efsob.integration.sms;
import com.google.common.base.Ascii;
import com.google.common.base.Charsets;
import com.google.common.base.Throwables;
import com.google.common.escape.Escaper;
import com.google.common.net.UrlEscapers;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
try {
final Future<SMSReplyIntegrationEntity> smsReplyIntegrationEntityFuture = sms.sendMessage("46708113432", "öäåöäasdfasfd", "efsob", "666");
final SMSReplyIntegrationEntity smsReplyIntegrationEntity = smsReplyIntegrationEntityFuture.get();
LOG.error("message",smsReplyIntegrationEntity.getResponseMessage());
LOG.error("code",smsReplyIntegrationEntity.getResponseCode());
} catch (Exception e) {
LOG.error("sms",e);
}
@oluies
oluies / gist:8704986
Created January 30, 2014 09:06
makeOption that takes an argument 'a' and returns Some(a) if 'a' is not of type Option and 'a' itself otherwise?
trait AsOption[T] {
type Out <: Option[_]
def apply(x: T): Out
}
@oluies
oluies / build.gradle
Last active December 15, 2015 08:18
gradle build script for scalascriptengine
apply plugin: 'scala'
group = 'com.googlecode.scalascriptengine'
version = '1.3.1-2.10.0'
description = """scalascriptengine"""
tasks.withType(ScalaCompile) {
scalaCompileOptions.useAnt = false
@oluies
oluies / gist:5091481
Created March 5, 2013 16:17
curl and openssl to validate clientcert
curl --key my.se.key --cert my.se.crt --cacert ca_steria.crt -k --verbose -debug -d "fel" https://url
openssl s_client -host host.se -port 443 -showcerts -CAfile ca_steria.crt -key my.se.key -cert my.se.crt
@oluies
oluies / gist:3519165
Created August 29, 2012 21:23
Caculating number of weeks based on birthdates
SELECT
calendar_date birth_date,
current_date - birth_date Diff_Days,
CASE WHEN Diff_Days >= 0 THEN (Diff_Days)/7
ELSE (Diff_Days +1) / 7 - 1 END
FROM sys_calendar.calendar
ORDER BY 1
@oluies
oluies / gist:3413761
Created August 21, 2012 09:03
findGaps
scala> List(3,4,5,8,9,10,12).sliding(2).collect{ case Seq(x, y) if(y != x + 1) => (x,y) }
res39: Iterator[(Int, Int)] = non-empty iterator
scala> .foreach(println(_) )
(5,8)
(10,12)
scala> def findGaps[T <: Int](xs:List[T]) = xs.sliding(2).collect{ case Seq(x, y) if(y != x + 1) => (x,y) }
findGaps: [T <: Int](xs: List[T])Iterator[(T, T)]
function luhn(cardnumber) {
// Build an array with the digits in the card number
var getdigits = /\d/g;
var digits = [];
while (match = getdigits.exec(cardnumber)) {
digits.push(parseInt(match[0], 10));
}
// Run the Luhn algorithm on the array
var sum = 0;
var alt = false;
@oluies
oluies / StupidBackoffLanguageModel.scala
Created April 14, 2012 16:43
StupidBackoffLanguageModel
import collection.GenMap
import scala.math
/**
* Created by IntelliJ IDEA.
* User: orjan
* Date: 2012-03-24
* Time: 15:15
* To change this template use File | Settings | File Templates.
*/