Skip to content

Instantly share code, notes, and snippets.

@degan
degan / gist:70e8059507d173751294
Last active August 29, 2015 14:16
FREAK Attack server test
see discussion below
@ismasan
ismasan / sse.go
Last active March 19, 2024 18:13
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
@iand
iand / gist:8581346
Last active January 4, 2016 06:19
Reasons why Go works for me

Some notes on why Go works for me and why it might work for you if you're looking for another language to add to your repetoire. Goes without saying that this reflects my personal taste.

Go features that I particularly like

  • Multicore is the future so I like that Go has concurrency built right into the core. Goroutines and channels provide a very accessible metaphor for thinking about concurrent programming. They're supported by language features that really make Go shine in this area. The select statement, for example, makes it easy to listen to and synchronise events from different concurrent threads.
  • Provides both pointers and value types, but the pointers are safe and managed. Automatic memory management means its safe to return a pointer to a local variable.
  • Interfaces in Go are smooth and unobtrusive. They automatically apply to anything with the right function signature so you can define interfaces that are satisfied by 3rd party code without you having to change it.
  • Errors are signale
@fmpwizard
fmpwizard / time-lapse.sh
Created November 12, 2013 01:30
Take pictures on the Raspberry Pi once a second and store them on a uuid named folder This runs at boot time using @reboot on cron
#!/bin/bash
let X=1;
folder=`/usr/bin/dbus-uuidgen`
cd /home/pi/camera/trip
mkdir $folder
cd $folder
while true; do
raspistill -rot 90 -w 1024 -h 768 -o $X.jpg
sync
echo "Image: $X.jpg";
@dadoonet
dadoonet / bluekiwi.sh
Created November 8, 2013 17:21
Bluekiwi example
curl -XDELETE "http://localhost:9200/bluekiwi"; echo
curl -XPUT "http://localhost:9200/bluekiwi/doc/1" -d'
{
"group":1,
"title":"test",
"content":"nothing",
"tags":["tag1","tag2"],
"authorId":1,
"creatorId":1
@cam-stitt
cam-stitt / FlightComponent.sublime-snippet
Last active December 25, 2015 17:59
Sublime Text snippet for coffee script flight component
<snippet>
<content><![CDATA[
define(function(require) {
var defineComponent = require('flight/lib/component');
return defineComponent(${1});
function ${1}() {
this.defaultAttrs({
@eltimn
eltimn / Build.scala
Last active December 22, 2015 12:49
SBT build with deploy.
import sbt._
import sbt.Keys._
object MyBuild extends Build {
import Dependencies._
import BuildSettings._
lazy val main = Project("root", file("."))
.settings(mainWebSettings: _*)
.settings(
@tgpfeiffer
tgpfeiffer / EndlessList.scala
Last active October 3, 2016 15:25
AJAX loading of new items in Lift (with Non-AJAX fallback)
class EndlessList {
/**
* Gets a "page" (e.g., 10 items) of content entities from the database.
*/
def getPage(page: Int): (Seq[Content], Boolean) = {
val realPage: Int = if (page < 1) 1 else page
val limit = 10
val contents = Content.findAll(
(/* conditions */),
@viktorklang
viktorklang / NonblockingCache.scala
Last active December 11, 2015 23:38
Nonblocking cache
/*©2013 Viktor Klang*/
package akka.util
import java.util.concurrent.atomic.AtomicReference
import scala.concurrent.{ Future, ExecutionContext }
import scala.annotation.tailrec
class Cache[K, V](__ec: ExecutionContext, throughput: Int) extends AtomicReference[Map[K, V]] {
implicit val executor = SerializedSuspendableExecutionContext(throughput)(__ec)
@tailrec final def update(f: Map[K, V] ⇒ Map[K, V]): Map[K, V] = {
val v = get
val nv = f(v)
@ymasory
ymasory / gist:3782247
Created September 25, 2012 14:24
Build Your Website in Scala in a Day

Build Your Website in Scala in a Day

This is a proposed event to be held in Philly. Comments welcome.

  • Theme is "Build Your Website in Scala in a Day". The goal would be for each participant to literally create and deploy a website in a Scala web framework in one day. No spectators; everyone builds a site! It can be your personal homepage, a hobby site, a business site, or anything else, so long as you fully intend to deploy (in alpha condition) at the end of the day.
  • The event would be oriented toward developers who already have a reasonable knowledge of Scala, but have never used it to build a website.
  • The event would be held on a Friday in 6-8 weeks, in Philadelphia. Friday because I want it to be a little more professional and business-oriented than Scalathon. Employers who actually need a website can send employees, for example.
  • It would feature 2 or 3 frameworks (to be determined, based on interest/availability of core developers to attend). There would be maybe 7-10 participants p