Skip to content

Instantly share code, notes, and snippets.

View larroy's full-sized avatar
🎧
In the zone

Pedro Larroy larroy

🎧
In the zone
View GitHub Profile
@larroy
larroy / gch.py
Created October 28, 2011 00:28
Precompiled header builder for SCons
#
# SCons builder for gcc's precompiled headers
# Copyright (C) 2006 Tim Blechmann (C) 2011 Pedro Larroy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@larroy
larroy / gist:3721452
Created September 14, 2012 11:41
Vim dark theme for eclipse
<?xml version="1.0" encoding="utf-8"?>
<colorTheme id="21" name="Vim" modified="2012-09-01 00:00:00" author="larroy">
<searchResultIndication color="#616161" />
<filteredSearchResultIndication color="#616161" />
<occurrenceIndication color="#616161" />
<writeOccurrenceIndication color="#616161" />
<findScope color="#B2B2B2" />
<deletionIndication color="#B2B2B2" />
<sourceHoverBackground color="#FFFFFF" />
<singleLineComment color="#54FFFF" />
#include "SSLBuffer.h"
SSLBuffer::SSLBuffer()
:ssl(NULL)
,read_bio(NULL)
,write_bio(NULL)
,write_to_socket_callback(NULL)
,write_to_socket_callback_data(NULL)
,read_decrypted_callback(NULL)
,read_decrypted_callback_data(NULL)
@larroy
larroy / .config
Created March 22, 2014 00:26
Acer c720 chromebook kernel config
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 3.14.0-rc7 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
@larroy
larroy / go.scala
Last active August 29, 2015 14:05 — forked from joa/go.scala
package go
import java.util.concurrent.{ArrayBlockingQueue => JArrayBlockingQueue, BlockingQueue => JBlockingQueue, TimeUnit}
object Channel {
def empty[A]: Channel[A] = new BlockingChannel()
def make[A]: Channel[A] = make(1)
def make[A](capacity: Int): Channel[A] = new BlockingChannel(capacity)
@larroy
larroy / BinarySearch.scala
Last active January 8, 2017 06:56
Binary search in scala
import scala.annotation.tailrec
object BinarySearch {
/**
* @param xs Sequence to search
* @param key key to find
* @param min minimum index (inclusive)
* @param max maximum index (inclusive)
* @param keyExtract function to apply to elements xs before comparing to key, defaults as identity
* @tparam T type of elements in the sequence
@larroy
larroy / selector.ls
Created February 4, 2015 17:26
html select with React + RxJS (livescript)
export mapchooser = (domToAttach)-->
R = this.React
observable = this.Rx.Observable.create((observer)->
MapChooser = R.create-class do
loadMaps: ->
$.getJSON(
"maps",
$.proxy((data) !->
response = $.parseJSON(data)
@setState(maps: response)
var observable = Rx.Observable.create(function (observer) {
var source = new Source
while (source.hasNext())
observer.onNext(source.getNext());
});
/************* without having to close over source ************/
case class A(a: Int, b: Vector[Int], c: Int)
case class B(a: Int, b: Seq[Int], c: Int)
val a = A(...
val b = B(...
val agen = Generic[A]
val bgen = Generic[B]
import java.util.concurrent.{TimeUnit, ArrayBlockingQueue, ThreadPoolExecutor}
import scala.concurrent.ExecutionContext
object ThrottlingExecutionContext {
def apply(poolSize: Int, maxQueued: Int): ExecutionContext = {
val workQueue = new ArrayBlockingQueue[Runnable](maxQueued) {
override def offer(x: Runnable): Boolean = {
put(x)
true