Skip to content

Instantly share code, notes, and snippets.

View alexy's full-sized avatar

Alexy Khrabrov alexy

View GitHub Profile
@MLnick
MLnick / StreamingHLL.scala
Last active January 24, 2024 19:39
Spark Streaming meets Algebird's HyperLogLog Monoid
import spark.streaming.StreamingContext._
import spark.streaming.{Seconds, StreamingContext}
import spark.SparkContext._
import spark.storage.StorageLevel
import spark.streaming.examples.twitter.TwitterInputDStream
import com.twitter.algebird.HyperLogLog._
import com.twitter.algebird._
/**
* Example of using HyperLogLog monoid from Twitter's Algebird together with Spark Streaming's
snmpd:
pkg.installed:
- name: {{ pillar['snmpd'] }}
- order: 1
/etc/snmp/snmpd.conf:
file.managed:
- source: salt://etc/snmp/snmpd.conf
- template: jinja
- requires:
@tbatchelli
tbatchelli / gist:4080635
Created November 15, 2012 19:25
proxy config for pallet-vmfest
{:provider "vmfest"
:environment{
:phases {:bootstrap
(fn [session]
(let [p (ns-resolve
'pallet.action.package 'package-manager)]
(->
session
(p :configure :proxy "http://10.0.2.2:3128"))))}
:proxy "http://10.0.2.2:3128"}}
@xiaoganghan
xiaoganghan / mynote.xml
Created July 27, 2012 07:26
Parsing Evernote export file (.enex) using Python
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export2.dtd">
<en-export export-date="20120727T073610Z" application="Evernote" version="Evernote Mac 3.0.5 (209942)">
<note><title>Vim Tips</title><content><![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">
<en-note style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
yank for copy, delete for cut, put for parse
<div><br/></div>
<div>Move in context, not position</div>
<div>/ search forward</div>
@viktorklang
viktorklang / minscalaactors.scala
Last active March 25, 2024 19:01
Minimalist Scala Actors
/*
Copyright 2012-2021 Viktor Klang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@peterhellberg
peterhellberg / gfm.rb
Created March 18, 2012 17:51
GitHub Flavored Markdown parser for use with Jekyll and Marked.app
#!/usr/bin/env ruby
require 'rubygems'
require 'redcarpet'
require 'pygments.rb'
class HTMLwithPygments < Redcarpet::Render::HTML
def block_code(code, language)
Pygments.highlight(code, :lexer => language.to_sym, :options => {
:encoding => 'utf-8'
})
@berngp
berngp / Measurable.scala
Created January 4, 2012 01:32
Trait with NewRelic and Scala Metrics.
import com.newrelic.api.agent.NewRelic
import collection.mutable.{HashMap, SynchronizedMap}
import com.yammer.metrics.{Timer, MetricsGroup}
trait Measurable {
protected lazy val metricsGroup = new MetricsGroup(this.getClass)
private val timers = new HashMap[String, Timer] with SynchronizedMap[String, Timer]
@mythz
mythz / basic-fsharp-gtk-demo.fs
Created September 15, 2011 05:16
Basic F# demo using Mono Gtk#
let btnUp = new Button("Increment", Visible=true)
let btnDown = new Button("Decrement", Visible=true)
let lbl = new Label(Text=" Count: 0", Visible=true)
Event.merge
(btnUp.Clicked |> Event.map (fun _ -> +1))
(btnDown.Clicked |> Event.map (fun _ -> -1))
|> Event.scan (+) 0
|> Event.map (sprintf " Count: %d")
|> Event.add (fun s -> lbl.Text <- s)
@kmizu
kmizu / GrepUsage.scala
Created July 1, 2011 22:16
Add grep method to any collection that holds String.
scala> import PimpGrepToCollection._
import PimpGrepToCollection._
scala> List("123", "156", "C").grep("\\d"){_.toInt}
res0: List[Int] = List(123, 156)
scala> Set("123", "456", "XXX").grep("\\d"){_.toInt}
res1: scala.collection.immutable.Set[Int] = Set(123, 456)
scala> Vector("A", "100", "XXX").grep("\\d"){_.toInt}
@canton7
canton7 / gist:1053846
Created June 29, 2011 13:35
git push, tracking, and push.default

git clone path/to/test/repo.git

push.default = matching (the default)

git config push.default matching

git branch -a
   * master