Skip to content

Instantly share code, notes, and snippets.

@kduy
kduy / build.sbt
Last active November 22, 2017 11:44 — forked from seratch/build.sbt
organization := "net.seratch"
name := "sandbox"
version := "0.1"
scalaVersion := "2.9.1"
libraryDependencies ++= Seq(
"junit" % "junit" % "4.9" withSources(),

Scala macros tutorial, using sbt

The following steps executed in order will;

  • create the project file structure
  • set the sbt version
  • add the gen-idea sbt plugin (if you want to import your project into intellij)
  • create an sbt build, that builds the macros project prior to the macrostest project (so the regex macro is usable in the macrostest project)
  • create the macros project scala file
  • create the macrostest project scala file
@kduy
kduy / introrx.md
Last active November 22, 2017 11:44 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@kduy
kduy / Macros.scala
Created June 10, 2015 09:05
Simple macro to get the value of Val by name
import scala.language.experimental.macros
import scala.reflect.macros.blackbox.Context
object Macros {
def getValue(varName: String) = macro getValueImpl
def getValueImpl(c: Context)(varName: c.Expr[String]): c.Expr[Any] = {
import c.universe._
val name = varName.tree match {
case Literal(Constant(x: String)) => x
@kduy
kduy / gist:d5c9ec7cd84d5300ca82
Last active November 22, 2017 11:44
Using Homebrew to manage Node.js and io.js installs on OSX

Using Homebrew to manage Node.js and io.js installs on OSX

Having both Node.js and io.js installed with NVM was giving me a load of problems, mainly with npm. So I uninstalled NVM and manage Node.js and io.js with homebrew.
Heres how.

Install Node.js and io.js

$ brew install node
$ brew install iojs

@kduy
kduy / .gitconfig
Created January 28, 2016 12:10 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@kduy
kduy / rm_mysql.md
Created February 8, 2016 16:58 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@kduy
kduy / Vagrant Setup.md
Created June 7, 2016 08:47 — forked from dergachev/README.md
Vagrant tutorial

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

@kduy
kduy / model.py
Created August 21, 2016 15:32 — forked from ck196/model.py
from __future__ import division, print_function, absolute_import
import pickle
import numpy as np
from PIL import Image
import tflearn
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.normalization import local_response_normalization
from tflearn.layers.estimator import regression
for i in $(ls ./)
do
new_name="${i/replace_this/with_this}"
echo $new_name
$(mv "./$i" "./$new_name")
done