Skip to content

Instantly share code, notes, and snippets.

View ee08b397's full-sized avatar
🎾

Songxiao Zhang ee08b397

🎾
  • BlackRock
  • New York, New York
  • 22:05 (UTC -04:00)
View GitHub Profile
@ee08b397
ee08b397 / gist:e86fb617fb5d5d68c6c2
Created March 4, 2016 01:40 — forked from osipov/gist:c2a34884a647c29765ed
Install Scala and SBT using apt-get on Ubuntu 14.04 or any Debian derivative using apt-get
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.10.4.deb
sudo dpkg -i scala-2.10.4.deb
sudo apt-get update
sudo apt-get install scala
wget http://scalasbt.artifactoryonline.com/scalasbt/sbt-native-packages/org/scala-sbt/sbt/0.12.4/sbt.deb
sudo dpkg -i sbt.deb
sudo apt-get update
sudo apt-get install sbt
@ee08b397
ee08b397 / gist:d63ad228bb7ddac02ae2
Created February 23, 2016 20:26 — forked from lentil/gist:810399
PEP8 pre-commit hook in Python
#!/usr/bin/env python
from __future__ import with_statement
import os
import re
import shutil
import subprocess
import sys
import tempfile
@ee08b397
ee08b397 / gist:831f9ad898013cb1311f
Last active February 16, 2016 01:09
setup new eclipse java
online install svn
Help -> Install New Software
change tab to spaces
https://alextheedom.wordpress.com/code-and-stuff/how-do-i-change-eclipse-to-use-spaces-instead-of-tabs/
change tab to 2
Window -> Preferences -> Java -> Code Style -> Formatter
Set author
@ee08b397
ee08b397 / mic_cam.md
Created February 10, 2016 16:45
Chrome mic & cam white list

Settings > Search "privacy" > content settings > Manage exceptions

add your site by regex, e.g., learn.com, add [*.]learn.com

@ee08b397
ee08b397 / ncdc.sh
Created February 2, 2016 00:27 — forked from aligusnet/ncdc.sh
Download a weather dataset from the National Climatic Data Center (NCDC, http://www .ncdc.noaa.gov/). Prepare it for examples of "Hadoop: The Definitive Guide" book by Tom White. http://www.amazon.com/Hadoop-Definitive-Guide-Tom-White/dp/1449311520 Usage: ./ncdc.sh 1901 1930 # download wheather datasets for period from 1901 to 1930.
#!/usr/bin/env bash
# global parameters
g_tmp_folder="ncdc_tmp";
g_output_folder="ncdc_data";
g_remote_host="ftp3.ncdc.noaa.gov";
g_remote_path="pub/data/noaa";

Setting up Flume NG, listening to syslog over UDP, with an S3 Sink

My goal was to set up Flume on my web instances, and write all events into s3, so I could easily use other tools like Amazon Elastic Map Reduce, and Amazon Red Shift.

I didn't want to have to deal with log rotation myself, so I setup Flume to read from a syslog UDP source. In this case, Flume NG acts as a syslog server, so as long as Flume is running, my web application can simply write to it in syslog format on the specified port. Most languages have plugins for this.

At the time of this writing, I've been able to get Flume NG up and running on 3 ec2 instances, and all writing to the same bucket.

Install Flume NG on instances

@ee08b397
ee08b397 / Kafka MultiNode - MultiBroker Cluster.md
Created January 20, 2016 17:10 — forked from mkanchwala/Kafka MultiNode - MultiBroker Cluster.md
Create Kafka Multi Node, Multi Broker Cluster
@ee08b397
ee08b397 / Spark-SingleRDDfrmMultipleFiles
Created January 20, 2016 17:10 — forked from mkanchwala/Spark-SingleRDDfrmMultipleFiles
Spark : How to create a Single RDD from Multiple Files
Best way to create Mutliple files into a single RDD
==================================
val fileRDD = sc.textFile(filename).repartition(1)
Where the filename is the location of your directory only.
@ee08b397
ee08b397 / tut.md
Created January 13, 2016 23:37
[ubuntu] reduce wifi channel overlapping

LinSSID is a graphical and functional wifi scanner for Ubuntu Linux, which is similar to iwscanner and Inssider. It can be easily installed in Ubuntu and Linux Mint via PPA repository. (Kismet didn't work for my Ubuntu 15)

sudo add-apt-repository -y ppa:wseverin/ppa
sudo apt-get update; sudo apt-get -y install linssid
@ee08b397
ee08b397 / fix.md
Last active December 13, 2015 23:41
Ubuntu-desktop stuck: displayport blinking got display panic

After reboot, gnome got stuck right after the purple "ubuntu" with several dots below, then only one non-flicking cursor on the top left. Then into recovery mode, try startx it says

X: cannot stat /etc/X11/X (No such file or directory), aborting

Fix

sudo dpkg-reconfigure xserver-xorg-lts-utopic

This restores the symlink /etc/X11/X -> /usr/bin/Xorg. I've tried to modify lightdm to gdm doesn't work. And xorg dpkg reconfigure doesn't work because I don't have it installed. I found I have xserver-xorg-lts-utopic.