Instantly share code, notes, and snippets.

Murilo Pereirampereira

• Sort options
Created Jun 25, 2018
View keybase.md

Keybase proof

I hereby claim:

• I am mpereira on github.
• I am mpereira (https://keybase.io/mpereira) on keybase.
• I have a public key ASCLp1gBxEh02WiE0zRjHUtGLvQtjFOKmX9OVyNYsBCV_Qo

To claim this, I am signing this object:

Last active Jul 18, 2017
Splits coll by pred. Returns a vector with a vector where (pred item) returns true followed by a vector where (pred item) returns false.
View split_by.clj
 (defn split-by "Splits coll by pred. Returns a vector with a vector where (pred item) returns true followed by a vector where (pred item) returns false. Example: (split-by pos? [0 1 2 -1 3 -2 4 -3]) => [[1 2 3 4] [0 -1 -2 -3]]" [pred coll] (reduce (fn [split item] (update split (if (pred item) 0 1) conj item))
Last active Jun 16, 2017
Returns a vector of [start end] offsets for substrings in s.
View substring_offsets.clj
 (defn substring-offsets "Returns a seq of [start end] offsets for substrings in s." [s substring] (when-not (empty? substring) (let [s (.toLowerCase s) substring (.toLowerCase substring) s-length (count s) substring-length (count substring)] (loop [offset 0 offsets nil]
Last active May 14, 2017
Merge sort implementation in JavaScript.
View merge_sort.js
 function merge(xs, leftStart, leftEnd, rightStart, rightEnd) { var i = leftStart; var j = rightStart; var merged = []; var currentLeft, currentRight; // Merge. while (i <= leftEnd || j <= rightEnd) { currentLeft = xs[i]; currentRight = xs[j];
Last active May 19, 2016
View find_pairs_sum_equal_k.clj
 (defn find-pairs-sum-equal-k [xs k] (let [x-indices (into {} (map-indexed (fn [idx x] [x idx]) xs))] (keep (fn [[x idx]] (if-let [x-complement-idx (get x-indices (- k x))] (when (not= idx x-complement-idx) [x (- k x)]))) x-indices))) (find-pairs-sum-equal-k (range 0 20) 12) ;; => ([0 12] [7 5] [1 11] [4 8] [3 9] [12 0] [2 10] [11 1] [9 3] [5 7] [10 2] [8 4])
Last active Dec 25, 2015
Show the total cost of an Amazon Wish List.
View amazon_wish_list.js
 // // This script shows the total cost of an Amazon Wish List. // // Usage: // // 1. Open an Amazon Wish List // 2. Select the "Compact" option in the "View" drop-down // 3. Click the "GO" button // 4. Copy and paste the code below in the browser console // 5. Press Enter
Created Sep 7, 2013
View eclim.log
 2013-09-07 10:01:47,341 DEBUG [main] - ScalaPlugin - added compilation unit __eclim_temp_person.scala 2013-09-07 10:01:47,342 INFO [main] - ScalaPresentationCompiler - shutting down presentation compiler on project: scala 2013-09-07 10:01:47,342 INFO [main] - ScalaProject - Scheduling for reconcile: ArrayBuffer() 2013-09-07 10:01:47,360 DEBUG [main] - ScalaProject - Added output folder: F/scala/src: F/scala/bin 2013-09-07 10:01:47,367 DEBUG [main] - ScalaProject - javabootclasspath: /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rhino.jar:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/pulse-java.jar:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-openjdk-common/
Created Sep 7, 2013
View eclim.log
 java -d64 -Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms40m -Xmx512m -jar /home/murilo/.eclipse/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar -debug -clean -refresh -application org.eclim.application_headless Install location: file:/home/murilo/.eclipse/ Configuration file: file:/home/murilo/.eclipse/configuration/config.ini loaded Configuration location: file:/home/murilo/.eclipse/configuration/ Framework located: file:/home/murilo/.eclipse/plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar Loading extension: reference:file:javax.transaction_1.1.1.v201105210645.jar
Last active Dec 22, 2015
View eclipse_plugins.txt
 \$ ls \$ECLIPSE_HOME/plugins | sort com.ibm.icu_4.4.2.v20110823.jar com.jcraft.jsch_0.1.44.v201101211721.jar com.sun.syndication_0.9.0.v200803061811.jar java_cup.runtime_0.10.0.v201005080400.jar javax.activation_1.1.0.v201105071233.jar javax.jws_2.0.0.v201005080400.jar javax.mail_1.4.0.v201005080615.jar javax.persistence_2.0.3.v201010191057.jar javax.servlet.jsp_2.0.0.v201101211617.jar
Created Aug 4, 2013
View steam_system_information.txt
 Processor Information: Vendor: GenuineIntel Speed: 2401 Mhz 4 logical processors 2 physical processors HyperThreading: Supported FCMOV: Supported SSE2: Supported SSE3: Supported SSSE3: Supported
You can’t perform that action at this time.