Skip to content

Instantly share code, notes, and snippets.

View natewave's full-sized avatar

Nizar S. natewave

View GitHub Profile
@natewave
natewave / hack.sh
Created April 2, 2012 08:37 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@natewave
natewave / contact.scala
Last active April 5, 2016 20:10
Generate contact information for S. Nizar
// Generate contact information for S. Nizar
// http://www.morningpotion.com
object contact {
val alpha = (('a' to 'z') ++ ('A' to 'Z')).mkString
val beta = ( (('A' to 'Z') drop 13)
++ (('a' to 'z') take 13)
++ (('A' to 'Z') take 13)
++ (('a' to 'z') drop 13)
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D from, to;
uniform float progress;
uniform vec2 resolution;
void glitch_memories(sampler2D pic) {
vec2 p = gl_FragCoord.xy / resolution.xy;
vec2 block = floor(gl_FragCoord.xy / vec2(16));
/*****************************************************************************
* QuantCup 1: Price-Time Matching Engine
*
* Submitted by: voyager
*
* Design Overview:
* In this implementation, the limit order book is represented using
* a flat linear array (pricePoints), indexed by the numeric price value.
* Each entry in this array corresponds to a specific price point and holds
* an instance of struct pricePoint. This data structure maintains a list

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

#!/bin/bash
SERVER=yourwebsite.com
tar -cjf- ~/.crypt/passwd ~/.ssh ~/.bashrc ~/.profile ~/.vimrc ~/.gitconfig \
~/.config/chromium ~/.mozilla \
| openssl enc -aes-256-cbc \
| ssh $SERVER 'cat>~/www/backup/`date +%F.%T`'
ssh $SERVER 'ls -1 ~/www/backup | grep ^[0-9] | sort > ~/www/backup/list.txt'
// Nizar S. <nisehl at gmail dot com>
import collection.JavaConversions._
import scala.collection.immutable.Map
import kafka.api._
import kafka.cluster.Broker
import kafka.common.OffsetAndMetadata
import kafka.common.OffsetMetadataAndError
import kafka.common.TopicAndPartition
15/09/13 20:26:54 INFO KafkaRDD: Computing topic defectRequests, partition 0 offsets -1 -> 290
15/09/13 20:26:54 ERROR TaskContextImpl: Error in TaskCompletionListener
java.lang.NullPointerException
at org.apache.spark.streaming.kafka.KafkaRDD$KafkaRDDIterator.close(KafkaRDD.scala:157)
at org.apache.spark.util.NextIterator.closeIfNeeded(NextIterator.scala:63)
at org.apache.spark.streaming.kafka.KafkaRDD$KafkaRDDIterator$$anonfun$1.apply(KafkaRDD.scala:100)
at org.apache.spark.streaming.kafka.KafkaRDD$KafkaRDDIterator$$anonfun$1.apply(KafkaRDD.scala:100)
at org.apache.spark.TaskContextImpl$$anon$1.onTaskCompletion(TaskContextImpl.scala:56)
at org.apache.spark.TaskContextImpl$$anonfun$markTaskCompleted$1.apply(TaskContextImpl.scala:75)
at org.apache.spark.TaskContextImpl$$anonfun$markTaskCompleted$1.apply(TaskContextImpl.scala:73)
def read[A, B](consumerConfig: ConsumerConfig, streamingContext: StreamingContext, maxRate: Int = DEFAULT_MAX_RATE)
(implicit keyRule: RuleLike[AvroValue, A], valueRule: RuleLike[AvroValue, B]): DStream[(VA[A], VA[B])] = {
val sparkConf = streamingContext.sparkContext.getConf
val appName = sparkConf.get("spark.app.name")
val offsetsCoordinator = OffsetsCoordinator.get(
channel = OffsetsCoordinator.newChannel(consumerConfig.host, consumerConfig.port),
clientId = consumerConfig.clientId,
groupId = consumerConfig.groupId)