Skip to content

Instantly share code, notes, and snippets.

@fbettag
fbettag / snort.cf
Created November 23, 2015 12:58
Deploy snort with CFEngine on FreeBSD. Use standard Masterfiles repo and place it in services/autorun/. Staging-Files for templates left as an excercise.
bundle agent snort
{
meta:
"tags" slist => { "autorun" };
vars:
linux::
"snort_package" string => "snort";
"snort_dir" string => "/etc/snort/";
"snort_path" string => "/usr/bin/snort";
@fbettag
fbettag / run-jetty.sh
Created December 29, 2014 21:50
Simple file to drop into jetty's distribution directory and start a lift application off of
#!/usr/bin/env bash
# yeah this really needs a bash! luckily this is not used by any server
NAME="software name (change in $0)"
RAMSIZE=1G
BASEPORT=9090
USAGE="Usage: $0 [start|stop] [dev|prev|prod]"
if [ $# -ne 2 ]; then echo $USAGE && exit 1; fi
@fbettag
fbettag / RecordToSolr.scala
Created December 25, 2014 11:43
Foursquare Slashem trait to save records to SOLR
import com.foursquare.slashem.SolrSchema
import com.twitter.finagle.http.RequestBuilder
import com.twitter.util.Awaitable
import net.liftweb.json._
import org.jboss.netty.buffer.ChannelBuffers._
import org.jboss.netty.handler.codec.http.{ HttpHeaders, HttpRequest, HttpResponse }
/**
* Trait to export Lift Record objects to SOLR
@fbettag
fbettag / Currencies.scala
Created July 12, 2014 09:37
Currency Converter in Scala (no rounding yet) based on Yahoo Finance and Twitter Finagle
import java.util.concurrent.atomic.AtomicReference
import com.twitter.finagle.{ http, Service }
import com.twitter.finagle.builder.ClientBuilder
import com.twitter.util.{ Promise, Future }
import org.jboss.netty.handler.codec.http._
import org.jboss.netty.util.CharsetUtil
import net.liftweb.util.Schedule
@fbettag
fbettag / run.sh
Created June 22, 2014 21:13
Liftweb Jetty run-script. Download a standard jetty dist tarball, extract it, put this script into the folder, update the variables at the top, copy your .war-file to webapps/ and run it.
#!/usr/bin/env bash
# yeah this really needs a bash!
NAME="lift project (change this in $0)"
RAMSIZE=256M
BASEPORT=8040
USAGE="Usage: $0 [start|stop] [dev|prev|prod]"
if [ $# -ne 2 ]; then echo $USAGE && exit 1; fi
@fbettag
fbettag / LiftAjaxField.scala
Created June 22, 2014 00:08
Liftweb dynamic input field creation directly from RequestVar and SessionVar
object SessionSettings {
object requestVar = net.liftweb.http.RequestVar[String]("")
object sessionVar = net.liftweb.http.SessionVar[String]("")
private def ajaxText[T <: AnyVar[String, _]](id: String, placeholder: String, field: T, validate: String => Boolean) = {
def customSet(str: String): JsCmd = {
if (validate(str)) {
field.set(str)
Noop
} else {
Dear Mickey,
so i tried the support case link at the bottom, but all i get after authentication is 400 Bad Request on everything i do..... So here it goes.
So it was the last week before my vacation, and absolutely nothing worked as normally expected.
I must admit that my brain did not really think about having Servers with NAT'ed IPs, which is absolutely great for the manangement perspective of a cloud environments, but it actually "shits" (excuse my french) on the real need for a server. If we wanted NAT, we'd find a way to make it work with DSL or Cable lines..
To be fair, i am against any kind of cloud environment since this trend started a few years back, and i've been nothing short with my assumption that it's all just crap for people who should not operate servers in the first place. So from my professional standpoint, having worked with EC2 for the first time, i can only recommend anyone not using it for anything more than a personal blog.
fuckmehard data # cd portage-2.2.1
fuckmehard portage-2.2.1 # ls
ChangeLog DEVELOPING LICENSE Makefile NEWS RELEASE-NOTES TEST-NOTES bin cnf doc man misc pym
fuckmehard portage-2.2.1 # make
set -e; \
touch "/data/portage-2.2.1/doc/fragment/date"; \
make -C "/data/portage-2.2.1/doc" xhtml xhtml-nochunks
make[1]: Entering directory `/data/portage-2.2.1/doc'
xmlto xhtml -m custom.xsl portage.docbook
make[1]: xmlto: Command not found
/data/usr-portage/profiles/updates/3Q-2011..........................
/data/usr-portage/profiles/updates/4Q-2011.............................................................................................................
/data/usr-portage/profiles/updates/1Q-2012.......................
/data/usr-portage/profiles/updates/2Q-2012........................
/data/usr-portage/profiles/updates/3Q-2012.....................................................
/data/usr-portage/profiles/updates/4Q-2012.............................................................
/data/usr-portage/profiles/updates/1Q-2013..................................................................................................
/data/usr-portage/profiles/updates/2Q-2013....................
/data/usr-portage/profiles/updates/3Q-2013.........
##
@fbettag
fbettag / gist:5976782
Created July 11, 2013 16:05
Lift Netty Integration Console output
[info] Running net.liftweb.netty.LiftNettyServer
17:10:57.428 [run-main] DEBUG i.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging framework
17:10:57.433 [run-main] DEBUG i.n.c.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 24
17:10:57.451 [run-main] DEBUG i.n.util.internal.PlatformDependent - UID: 501
17:10:57.452 [run-main] DEBUG i.n.util.internal.PlatformDependent - Java version: 7
17:10:57.452 [run-main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noUnsafe: false
17:10:57.454 [run-main] DEBUG i.n.util.internal.PlatformDependent0 - java.nio.ByteBuffer.cleaner: available
17:10:57.455 [run-main] DEBUG i.n.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
17:10:57.455 [run-main] DEBUG i.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
17:10:57.455 [run-main] DEBUG i.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available