Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Arash Rouhani Tarrasch

I may be slow to respond.
Block or report user

Report or block Tarrasch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Tarrasch /
Last active Mar 21, 2017
Python program that read stdin and put it in array line by line
import sys
def main():
stdin_lines = []
for line in sys.stdin:
if line.strip() != "":
# ... My code here ...
Tarrasch /
Created Oct 5, 2016
Fix font for Vietnamese plots in matplotlib python lib
# I Used this with a IPython notebook using pandas, but I suppose that part isn't relevant
# Big thanks to guy who wrote this:
# I had the problem that vietnamese characters showed as empty boxes. Although tones displayed properly.
# Here's the code to fix it:
import matplotlib
import matplotlib.font_manager as font_manager
public class VietnameseDiacritics {
// this is only pseudo code, not meant to compile
public static String allVietnameseCombiningDiacriticalMarks() {
String s = "ạàáãảâăư"; // đ is not counted as a diacratic apparently
s = java.text.Normalizer.normalize(s, java.text.Normalizer.Form.NFD);
s = s.replaceAll("[^\\p{InCombiningDiacriticalMarks}]", "");
return s;
View hackathon-idea-saigon-2016.txt
Okay. I finally have an idea! I'm writing it here since some people asked me about it in a PM. I think this idea could be useful because: (1) it's quite simple (2) it only uses one technology (Messenger API) and (3) is localized to Saigon (4) the completed product could be monetized (although I don’t have that ambition :)). Furthermore I would like something like this myself. For added cuteness and confusion I'm trying to write the rest of the post in Vietnamese:
Lúc nào tôi cũng muốn đi ăn uống với những bạn, tụi tôi phải chọn một chỗ. là rất tất tại vì có review, có địa chỉ, có ảnh rõ đẹp. Nhưng mà tôi thấy là và nhũng site bằng đó thiếu một feature. Đó là rất là khó kiếm tìm chỗ. Tại sao? không có map tốt, site lúc nào cũng chậm, có ads vói lại tôi thấy là là scroll hell. Xong rồi
Với chatbot, có thể mình được implement một cuộc trò chuyện như sau:
người dùng: Tôi muốn ăn
bot: ở đâu vậy? (với lại tặng suggestion nên làm interface dễ dùng)
Tarrasch / contestapplet.conf
Created Jul 15, 2016
My TopCoder contestapplet.conf, as I don't want to keep it around in my /home folder anymore
View contestapplet.conf
#TopCoder ContestApplet Preferences File
#Sat Apr 19 19:43:11 CEST 2014
Tarrasch /
Last active May 17, 2016
Saving and loading objects from a Path in Java
// These methods could be pasted in a class.
// I found these two implementations to be better than what was provided in various library-provided util classes. Because these methods mute no exceptions.
// These version are also not dependent if you use files from disk or not.
private static void writeObjectToDisk(Object o, Path p) throws IOException {
try (OutputStream os = Files.newOutputStream(p);
ObjectOutputStream oos = new ObjectOutputStream(os)) {
Tarrasch /
Created Apr 7, 2016
Playing around with muting exception in Java 8
public class Helpers {
public static <T> T getWithRTE(ExceptionSupplier<T> exceptionThrower) {
try {
return exceptionThrower.get();
} catch (Exception e) {
throw new RuntimeException(e);
Tarrasch /
Last active Jan 16, 2016
Resources for vietnamese input


I want to use colemak+telex on Ubuntu 14.04. Preferably switching betweeen them with a keyboard shortcut.


canhaz ibus-unikey
sudo cp /usr/share/ibus/component/unikey.xml{,-orig}
curl | sudo tee /usr/share/ibus/component/unikey.xml
View gist:830e0a22ee4af120fc86
~/spotify/repos/gcp-migrate various-improvements
❯ git remote -v
origin (fetch)
origin (push)
upstream (fetch)
upstream (push)
~/spotify/repos/gcp-migrate various-improvements
❯ git fetch --all
Fetching origin
Tarrasch /
Created Aug 29, 2014
Currently, our skeleton doesn't instantiate everything
import datetime
import luigi
from spotify.luigi.crunch import ScrubJobTask, load_avsc
from spotify.luigi import HdfsTarget
from spotify.luigi.external_shrek_anonym import CreateEndSongCleaned
class SampleEndSongSubset(luigi.ExternalTask):
def output(self):
return HdfsTarget("/user/spotify-analytics-data/examples/data_pipeline_crunch/stream_count_anonym")
You can’t perform that action at this time.