This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd | |
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
exec $SHELL | |
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc | |
exec $SHELL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list" | |
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install postgresql-common | |
sudo apt-get install postgresql-9.3 libpq-dev | |
#Create a user for postgres | |
sudo -u postgres createuser username -s | |
# If you would like to set a password for the user, you can do the following |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git remote add origin https://github.com/MBtech/HDFSFileHandler.git | |
git push -u origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
tshark -r ip_complete.pcap -2R "ip.src==10.0.1.1 and tcp.flags.syn==1 and tcp.flags.ack!=1" -n -Tfields -e tcp.stream > stream_names | |
sleep 10 | |
cmd="tshark -r ip_complete.pcap -2R \"ip.src==10.0.1.1 and (" | |
while read line; | |
do | |
new="tcp.stream eq $line or " | |
cmd=$cmd$new | |
done < stream_names | |
cmd=$cmd"tcp.stream eq 10000)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package com.learningcurve.mb.restclient; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void restartwifi(Context serviceContext) throws InterruptedException { | |
WifiManager wifiManager = (WifiManager) serviceContext.getSystemService(Context.WIFI_SERVICE); | |
if(wifiManager.isWifiEnabled()) { | |
wifiManager.setWifiEnabled(false); | |
Thread.sleep(3000); | |
wifiManager.setWifiEnabled(true); | |
Thread.sleep(3000); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while ! nc -q 1 localhost 2181 </dev/null; do echo "Waiting"; sleep 1; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package mb.learningcurve.Cassandra; | |
import com.datastax.driver.core.Cluster; | |
import com.datastax.driver.core.ResultSet; | |
import com.datastax.driver.core.Row; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Taken from the stack overflow question | |
//http://stackoverflow.com/questions/4534924/how-to-iterate-through-range-of-dates-in-java | |
//When starting off with java.util.Date instances like below: | |
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); | |
Date startDate = formatter.parse("2010-12-20"); | |
Date endDate = formatter.parse("2010-12-26"); | |
//Here's the legacy java.util.Calendar approach in case you aren't on Java8 yet: | |
Calendar start = Calendar.getInstance(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL u = new URL ( "http://www.example.com/"); | |
HttpURLConnection huc = ( HttpURLConnection ) u.openConnection (); | |
huc.setRequestMethod ("GET"); //OR huc.setRequestMethod ("HEAD"); | |
huc.connect () ; | |
int code = huc.getResponseCode() ; | |
System.out.println(code); |
OlderNewer