Skip to content

Instantly share code, notes, and snippets.

package sample.cluster.simple
import scala.concurrent.duration._
import akka.actor._
import akka.cluster.Cluster
import akka.cluster.ClusterEvent._
import akka.routing.FromConfig
import com.typesafe.config.ConfigFactory
object SimpleRouterApp {
@RajeshReddyM
RajeshReddyM / export_mongoid_docs_to_csv
Created July 30, 2013 11:00
Export Mongoid documents to csv from command line
1. Export documents to csv
mongoexport -d database_name -c collection_name -f field1,field2,field3 -q '{"created_at":{"$gt": new Date(1373913000000), "$lt": new Date(1375036200000)}}' --csv -o docs.csv
@Vivelin
Vivelin / gist:6112013
Created July 30, 2013 10:59
This is why you need Option Strict On.
Dim list As IList(Of String) = text.Split(" ")
Dim number As String = ""
For Each entry In list
If Char.IsDigit(entry) Then
number = entry
Exit For
End If
Next
If number = 1 Then
Return True
@ryanlewis
ryanlewis / gist:6112001
Last active December 20, 2015 09:59
Get difference between two commits. Powershell snippet to filter out a list of changed files by extension from git diff --stat
git diff 1.0.2 HEAD --stat=200
git diff 1.0.2 HEAD --stat=500 | where {$_ -Match ".cshtml|.css"} | %{$line=$_.split(" "); write-host $line[1] }
git diff 1.0.2 HEAD --stat=200 | where {$_ -Match ".cshtml|.cs"} | %{$l=$_.split(" "); $file=$l[1]; $file=$file.replace("Umbraco.Site", ""); write-host $file }
@PatrickMcDonald
PatrickMcDonald / reg.bat
Created July 30, 2013 10:56
Modify registry from command-line
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\SystemCore\VSCore\On Access Scanner\McShield\Configuration\Default" /v "ScanArchives" /t REG_DWORD /d 0
@scottdweber
scottdweber / DoubleMeasureRelativeLayout.java
Created July 20, 2013 21:50
An extended RelativeLayout that fixes layout issues when the size of the layout is inexact (that is, wrap_content) and you want to base the positioning of one or more child views on the positioning of another child view that is itself positioned by layout_centerInParent, layout_centerHorizontal or layout_centerVertical. It is clearly not efficie…
/*
* Copyright (C) 2013 Scott Weber
*
* 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
# Styled like the default prompt in Ubuntu 9.04 Jaunty
# Cloned by Steve Gargan
#
prompt_ubuntu_setup ()
{
local userhost=${1:-'green'}
local cwd=${2:-'blue'}
PS1="%B%F{$userhost}%n@%m%F{$cwd%}:%~%# %b%k%f"
PS2="> "
@jps
jps / CacheItem.sql
Created June 11, 2013 20:16
Creates the cache Item table for the persistent caching example
CREATE TABLE TestDB.dbo.CacheItem(
CacheItemID INT PRIMARY KEY,
Name VARCHAR(255) UNIQUE NOT NULL,
Value VARCHAR(4000),
Value_Type VARCHAR(255) NOT NULL,
Expires DATETIME
)
In order for this to work you need ffmpeg. I tried with version 1.2.1.
1) Play the video you want to download in the browser
2) Inspect the video element on the page
3) Copy the video url from the page source (something like http://devstreaming.apple.com/videos/wwdc/2013/.../101/ref.mov)
4) In this url replace "ref.mov" with "iphone_c.m3u8" (for 960x540 resolution) or "atp.m3u8" if you want more (probably 720p?)
5) Execute `ffmpeg -y -i http://devstreaming.apple.com/videos/wwdc/2013/.../101/iphone_c.m3u8 output.mp4`
6) There is your video :)
@heathermiller
heathermiller / EdnPickleFormat.scala
Created June 11, 2013 20:09
A sample simplified edn PickleFormat for Scala Pickling. That's right, transfer data to a Clojure app! (Edn stands for "extensible data notation" and is Clojure's data transfer format.)
import scala.pickling._
import scala.reflect.runtime.universe._
import scala.util.parsing.json._
import scala.collection.mutable.{StringBuilder, Stack}
package object edn {
implicit val pickleFormat: EdnPickleFormat = new EdnPickleFormat
}