Skip to content

Instantly share code, notes, and snippets.

View lucperkins's full-sized avatar
🎯
Focusing

Luc Perkins lucperkins

🎯
Focusing
View GitHub Profile
@lucperkins
lucperkins / hegel.dart
Created December 9, 2013 21:15
Some Hegel-flavored musings. In #dartlang, of course.
abstract class Being {}
abstract class Nothing {}
abstract class Becoming extends Being with Nothing {}
abstract class Nature extends Becoming {}
abstract class Lack extends Nature {}
abstract class LivingThing extends Lack {}
class Person extends LivingThing {
String name;
Person(this.name);
@lucperkins
lucperkins / floatingMenu.css
Last active December 30, 2015 20:59
Here's a Gist for HTML/CSS/JS for a menu bar that is both draggable and resizable AND stores the height/width and position of the bar in local storage, so that the dimensions and position persist through refresh. There is a <p> element inside of the floating bar that is the only element that can be clicked on to drag the bar. This can be disable…
#floatingMenu {
border: 1px solid black;
}
@lucperkins
lucperkins / components.dart
Created January 27, 2014 03:06
Making data types iterable in Dart
@CustomTag('x-note-element')
class NoteElement extends LIElement with Polymer, Observable {
@published Note note;
NoteElement.created() : super.created();
}
@CustomTag('x-notebook-element')
class NotebookElement extends PolymerElement {
@published Notebook notebook = new Notebook(new List<Note>());
NotebookElement.created() : super.created();
@lucperkins
lucperkins / riak_security.md
Last active August 16, 2016 06:09
Blog article on Riak 2.0 security

Riak Security 2.0: Not Just a Firewall Anymore

If you wanted to use Riak in a secure fashion in versions prior to 2.0, your only option was to do so at the network level, using a firewall or similar protective layer. While this is sufficient for a lot of use cases, the problem with this form of security is that if someone can penetrate the firewall, they essentially have unrestricted access to a Riak cluster. They can perform reads and writes, run MapReduce jobs, you name it.

In Riak version 2.0, this is changing in dramatic fashion. While you can still apply a network security layer if you wish, Riak now comes with security features that protect Riak itself and not just to the network in which it's housed. Most importantly, in Riak 2.0 you can both authorize users to perform specific tasks (from standard read/write/delete operations to search queries to managing bucket types) and authenticate users and clients using a variety of security mechanisms.

I

@lucperkins
lucperkins / migration.py
Last active November 7, 2016 11:15
Migrate SQL table to Riak
import psycopg2
from riak import RiakClient, RiakObject
from riak.datatypes import Set
import datetime
# Riak connection and set
client = RiakClient(pb_port=8087)
SETS_BUCKET = client.bucket_type('sets').bucket('key_sets')
# Get columns for table
package tutorial;
import backtype.storm.metric.api.GlobalMetrics;
import org.apache.storm.Config;
import org.apache.storm.LocalCluster;
import org.apache.storm.StormSubmitter;
import org.apache.storm.spout.SpoutOutputCollector;
import org.apache.storm.task.OutputCollector;
import org.apache.storm.task.TopologyContext;
import org.apache.storm.topology.OutputFieldsDeclarer;
<body>
<header>
<nav>
<section class="brand">
<img src="logo.png">
</section>
<section class="menu">
<ul>
<li>
<a href="/products">
PulsarClient client = PulsarClient.builder()
.serviceUrl("pulsar://localhost:6650")
.build();
Producer<SensorReading> producer =
client.newProducer(JSONSchema.of(SensorReading.class))
.topic("sensor-data")
.create();
Consumer<SensorReading> consumer =
/*
{{- if ne (getenv "HUGO_ENV") "production" }}
X-Robots-Tag: noindex
{{- end }}
@lucperkins
lucperkins / todos.proto
Last active October 24, 2018 16:41
todos.proto
syntax = “proto3”;
package todos;
message Todo {
string content = 1;
bool finished = 2;
}
message GetTodoRequest {