Find it here: https://github.com/bitemyapp/learnhaskell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited | |
# | |
# Current known FCC address ranges: | |
# https://news.ycombinator.com/item?id=7716915 | |
# | |
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft | |
# | |
# In your nginx.conf: | |
location / { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def ^ThreadLocal stack-depth (ThreadLocal.)) | |
(def ^Executor overflow-protection-pool | |
(let [cnt (atom 0)] | |
(Executors/newCachedThreadPool | |
(thread-factory #(str "manifold-overflow-protection-pool-" (swap! cnt inc)))))) | |
(def ^:const max-depth 50) | |
(defmacro without-overflow [& body] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val des = scala.concurrent.ExecutionContext.global | |
import scala.concurrent._ | |
import duration._ | |
def ct = Thread.currentThread.getName | |
val n = Runtime.getRuntime.availableProcessors | |
def hogThread(sec:Int) = future { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clojure.string :as s]) | |
;; My initial attempt | |
(def c [:0 :1 :2 :3 :4 :5 :6 :7 :8 :9 :A :B :C :D :E :F]) | |
(str "#" (s/join (map name (repeatedly 6 #(rand-nth c))))) | |
;; Another option not using keywords (/ht locks in #clojure) | |
(def c [0 1 2 3 4 5 6 7 8 9 \A \B \C \D \E \F]) | |
(str "#" (s/join (repeatedly 6 #(rand-nth c)))) | |
;; the last line can be simplified even more (/ht xificurC in #clojure) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.util.Properties; | |
import kafka.server.KafkaConfig; | |
import kafka.server.KafkaServerStartable; | |
public class KafkaLocal { | |
public KafkaServerStartable kafka; | |
public ZooKeeperLocal zookeeper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
packaging :war | |
phase :package do | |
plugin 'de.saumya.mojo:jruby-maven-plugin', '1.0.0-rc3' do | |
execute_goal( :jruby, | |
:id => 'pack-war with warbler', | |
:filename => 'warble', | |
:gemUseSystem => true ) | |
execute_goal( :jruby, | |
:id => 'move war to maven build dir', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Zameers-MacBook-Air:~ zmanji$ scala | |
Welcome to Scala version 2.10.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_17). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> null == null.asInstanceOf[Int] | |
<console>:8: warning: comparing values of types Null and Int using `==' will always yield false | |
null == null.asInstanceOf[Int] | |
^ | |
res0: Boolean = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%\n", $10/$5 * 100)}' |
Kafka acts as a kind of write-ahead log (WAL) that records messages to a persistent store (disk) and allows subscribers to read and apply these changes to their own stores in a system appropriate time-frame.
Terminology:
- Producers send messages to brokers
- Consumers read messages from brokers
- Messages are sent to a topic