Skip to content

Instantly share code, notes, and snippets.

View joyoyoyoyoyo's full-sized avatar
🏴
supporting my community

Angel Ortega joyoyoyoyoyo

🏴
supporting my community
  • InterMedia Advertising
  • SoCal / Remote / LA / IE
View GitHub Profile
@ekoontz
ekoontz / gist:1871529
Created February 20, 2012 21:19
yarn application class path:
<property>
<name>yarn.application.classpath</name>
<value>/usr/lib/hadoop-0.23-tm-6/share/hadoop/common/*:/usr/lib/hadoop-0.23-tm-6/share/hadoop/mapreduce/*:/usr/lib/hadoop-0.23-tm-6/share/hadoop/common/lib/*:/usr/lib/hadoop-0.23-tm-6/share/hadoop/hdfs/*:/usr/lib/hadoop-0.23-tm-6/share/hadoop/mapreduce/lib/*</value>
</property>
@arschles
arschles / gist:2288158
Created April 3, 2012 00:06
Scala PhoneGap Build Client
val BaseBuildURL = "https://build.phonegap.com/api/v1"
val UTF8Charset = Charset.forName("UTF-8")
case class MultipartInfo(contentType: Header, contentEncoding: Option[Header])
val baseHeaders: List[Header] = {
val authRaw = "%s:%s".format(phoneGapCreds.username, phoneGapCreds.password)
val authBase64 = Base64.encodeBase64(authRaw.getBytes(UTF8Charset))
val authString = new String(authBase64, UTF8Charset)
List(
new BasicHeader(HttpHeaders.AUTHORIZATION, "Basic %s".format(authString)),
new BasicHeader(HttpHeaders.ACCEPT, "*/*"),
@killerswan
killerswan / count.hs
Created April 26, 2012 07:22
Haskell back in awk's order of magnitude <_<
-- Kevin Cantu
-- April 2012
import Control.Monad (when)
import Data.Map (Map)
import Data.List
import Data.List.Split
import qualified Data.Map as M
import System.Environment
import System.IO
@jboner
jboner / latency.txt
Last active May 19, 2026 22:34
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@igm
igm / HttpServer.scala
Created June 15, 2012 11:53
Simple HTTP Server in Scala & Java 7 (async I/O)
import java.lang.Character.{ LETTER_NUMBER => CR,LINE_SEPARATOR => LF }
import java.net.InetSocketAddress
import java.nio.channels.AsynchronousChannelGroup._
import java.nio.channels.AsynchronousServerSocketChannel._
import java.nio.channels.{ AsynchronousSocketChannel => ASC }
import java.nio.channels.CompletionHandler
import java.nio.ByteBuffer._
import java.util.concurrent.Executors._
import scala.annotation.implicitNotFound
import scala.collection.mutable.ListBuffer
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 18, 2026 12:31
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@dholbrook
dholbrook / Tree.scala
Created June 21, 2012 17:59
Scala binary tree
/**
* D Holbrook
*
* Code Club: PO1
*
* (*) Define a binary tree data structure and related fundamental operations.
*
* Use whichever language features are the best fit (this will depend on the language you have selected). The following operations should be supported:
*
* Constructors
@spiegela
spiegela / csv.rb
Created August 10, 2012 04:07
Command line script to Parse CSV files
#!/usr/bin/env ruby
# How about an awesome command-line script
# that replaces your usage of "awk -F, ..."
# for like 99% of cases.
#
# Also, importantly, it supports CSV features
# like escaping commas when quoted
#
# Usage: csv.rb [options] <filename>
@ngocdaothanh
ngocdaothanh / gist:3764694
Created September 22, 2012 00:43
Scala Assignment: Recursion
package recfun
import scala.collection.mutable.ListBuffer
import common._
/** https://class.coursera.org/progfun-2012-001/assignment/view?assignment_id=4 */
object Main {
def main(args: Array[String]) {
println("Pascal's Triangle")
for (row <- 0 to 10) {
@anoopelias
anoopelias / Manifest.md
Last active January 20, 2019 08:24
Using Manifest to get around with type erasure in scala

Typically, you can't use a 'new' operator on a generic type. This is because of type erasure.

scala> def create[T] = new T
<console>:7: error: class type required but T found
   def create[T] = new T
                       ^

Scala gives a way of getting around this problem, with the Manifest class.

scala> def create[T](implicit m:Manifest[T]) = m.erasure.newInstance