Skip to content

Instantly share code, notes, and snippets.

View rrshaban's full-sized avatar

Razi rrshaban

View GitHub Profile
@rrshaban
rrshaban / FizzBuzz.exs
Last active January 12, 2016 16:40
FizzBuzz in Elixir
fb_helper = fn
(0, 0, _) -> "FizzBuzz"
(0, _, _) -> "Fizz"
(_, 0, _) -> "Buzz"
(_, _, x) -> x
end
fizz_buzz = fn
n -> fb_helper.(rem(n, 3), rem(n, 5), n)
end
login2.stampede(23)$ make
/bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I./src -I./src -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -DNO_FRAME_POINTER -DNDEBUG -g -O2 -MT libglog_la-logging.lo -MD -MP -MF .deps/libglog_la-logging.Tpo -c -o libglog_la-logging.lo `test -f 'src/logging.cc' || echo './'`src/logging.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I./src -I./src -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -DNO_FRAME_POINTER -DNDEBUG -g -O2 -MT libglog_la-logging.lo -MD -MP -MF .deps/libglog_la-logging.Tpo -c src/logging.cc -fPIC -DPIC -o .libs/libglog_la-logging.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I./src -I./src -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -DNO_FRAME_POINTER -DNDEBUG -g -O2 -MT libglog_la-logging.lo -MD -MP -MF .deps/libglog_la-logging.Tpo -c src/logging.cc -o libglog_la-logging.o >/dev/null 2>&1
makemv -f .deps/libglog_la-logging.Tpo .deps/libglog_la-logging.Plo
/bin/sh ./libtool --tag=CXX
@rrshaban
rrshaban / gist:32e9bd7c505f901a9c29
Created October 3, 2015 21:22
luarocks install cutorch
$ luarocks install cutorch
Installing https://raw.githubusercontent.com/torch/rocks/master/cutorch-scm-1.rockspec...
Using https://raw.githubusercontent.com/torch/rocks/master/cutorch-scm-1.rockspec... switching to 'build' mode
Cloning into 'cutorch'...
remote: Counting objects: 81, done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 81 (delta 7), reused 23 (delta 0), pack-reused 0
Receiving objects: 100% (81/81), 122.25 KiB | 0 bytes/s, done.
Resolving deltas: 100% (7/7), done.
Checking connectivity... done.
@rrshaban
rrshaban / gist:2cc0e6ff42508f0f4118
Created September 21, 2015 15:43
produce image of neural network using caffe
python /scratch/rshaban1/caffe/python/draw_net.py ~/deep/mnist/mnist_train_test.prototxt ~/out.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rrshaban
rrshaban / 2015-07-26-0552.gpx
Created August 17, 2015 15:20
2015-07-26-0552.gpx
<?xml version="1.0" encoding="UTF-8"?>
<gpx
version="1.1"
creator="Runkeeper - http://www.runkeeper.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/1"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1">
<trk>
<name><![CDATA[Running 7/26/15 5:52 am]]></name>
@rrshaban
rrshaban / tree_hexo
Created July 5, 2015 09:47
running `tree` on the directory created by `hexo init`
$ tree
.
├── _config.yml
├── package.json
├── scaffolds
│   ├── draft.md
│   ├── page.md
│   └── post.md
├── source
│   └── _posts

Two minute introduction to screen

Screen is super-useful because it allows you to run terminal commands without needing to have your terminal window open.

Think of a screen as a session: you can open a screen, start a script, and then detach from it. The script will keep running in the background, but you can keep doing whatever you were doing without affecting the script. More significantly, if you want to be able to step away from your terminal, or close your laptop, or let a task run overnight without needing you to be connected, use a screen.

This quick tutorial will walk you through the basic commands necessary to get a screen working without worrying about what's going on behind the scenes.

Start a screen session

@rrshaban
rrshaban / gnip_curl_tutorial.md
Last active August 29, 2015 14:23
GNIP curl commands

Create a GNIP job

curl -v -X POST -u <USER>@idibon.com "https://historical.gnip.com/accounts/idibon/jobs.json" -d '{"publisher":"twitter","streamType":"track","dataFormat":"activity-streams","fromDate":"201501010000","toDate":"201506010001","title":"arabizi_testing","rules":[{"value":"3omry","tag":"3omry"},{"value":"3ala","tag":"3ala"},{"value":"enta","tag":"enta"},{"value":"ma3ak","tag":"ma3ak"}]}'

The JSON expanded is below. For some shoddy documentation about this process and a general overview of the process, check out GNIP's API Documentation. But this gist will be far more useful.

curl -v -X POST -u @idibon.com "https://historical.gnip.com/accounts/idibon/jobs.json" -d '{ "publisher": "twitter", "streamType": "track", "dataFormat": "activity-streams", "fromDate": "201501010000",

@rrshaban
rrshaban / emogi.regex
Last active November 22, 2016 13:07
Emoji regex
[\u{00A9}\u{00AE}\u{203C}\u{2049}\u{2122}\u{2139}\u{2194}-\u{2199}\u{21A9}-\u{21AA}\u{231A}-\u{231B}\u{2328}\u{23CF}\u{23E9}-\u{23F3}\u{23F8}-\u{23FA}\u{24C2}\u{25AA}-\u{25AB}\u{25B6}\u{25C0}\u{25FB}-\u{25FE}\u{2600}-\u{2604}\u{260E}\u{2611}\u{2614}-\u{2615}\u{2618}\u{261D}\u{2620}\u{2622}-\u{2623}\u{2626}\u{262A}\u{262E}-\u{262F}\u{2638}-\u{263A}\u{2648}-\u{2653}\u{2660}\u{2663}\u{2665}-\u{2666}\u{2668}\u{267B}\u{267F}\u{2692}-\u{2694}\u{2696}-\u{2697}\u{2699}\u{269B}-\u{269C}\u{26A0}-\u{26A1}\u{26AA}-\u{26AB}\u{26B0}-\u{26B1}\u{26BD}-\u{26BE}\u{26C4}-\u{26C5}\u{26C8}\u{26CE}-\u{26CF}\u{26D1}\u{26D3}-\u{26D4}\u{26E9}-\u{26EA}\u{26F0}-\u{26F5}\u{26F7}-\u{26FA}\u{26FD}\u{2702}\u{2705}\u{2708}-\u{270D}\u{270F}\u{2712}\u{2714}\u{2716}\u{271D}\u{2721}\u{2728}\u{2733}-\u{2734}\u{2744}\u{2747}\u{274C}\u{274E}\u{2753}-\u{2755}\u{2757}\u{2763}-\u{2764}\u{2795}-\u{2797}\u{27A1}\u{27B0}\u{27BF}\u{2934}-\u{2935}\u{2B05}-\u{2B07}\u{2B1B}-\u{2B1C}\u{2B50}\u{2B55}\u{3030}\u{303D}\u{3297}\u{3299}\u{1F004}\u{1F0CF}\u{1F170}-