This file contains hidden or 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
boolean isPalindrome(String s) { | |
for(int front = 0, end = s.length() - 1; front <= end; front++, end--) { | |
if(s.charAt(front) != s.charAt(end)) { | |
return false; | |
} | |
} | |
return true; | |
} |
This file contains hidden or 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
/** | |
* Created by daniel robertson on 9/6/15. | |
*/ | |
import java.io.*; | |
import java.util.*; | |
import java.lang.StringBuffer; | |
public class NumberOfPalindromicSubstrings { | |
static int palindrome(String str) { | |
int result = 0; |
This file contains hidden or 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
Assumptions: | |
- Sublime has been installed under Applications/ and that the application subl exists at /Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl | |
- /usr/loca/bin is in your PATH. You can verify this by viewing the contents of your path by running 'cat /etc/paths' | |
Run 'sudo ln -s "/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl' | |
This file contains hidden or 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
class Multiton { | |
static HashMap<String, Multiton> map = new HashMap<String, Multiton>(); | |
private Multiton(String key) { ... } | |
static Multiton newMultion(String key) { | |
result = map.get(key); | |
if(result == null) { | |
result = new Multiton(key); | |
map.add(key, result); |
This file contains hidden or 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
[user] | |
name = Daniel Robertson | |
email = [email protected] | |
[alias] | |
p = pull | |
a = add | |
st = status | |
ci = commit | |
br = branch |
This file contains hidden or 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
import pandas as pd | |
toclean = pd.read_csv('fileWithDuplicates.csv') | |
deduped = toclean.drop_duplicates('columnName') | |
deduped.to_csv('fileWithoutDuplicates.csv') |
This file contains hidden or 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
{ | |
"registration": { | |
"children": [ | |
{ | |
"firstName": "joe", | |
"lastName": "bro", | |
"dob": "11 march 1990" | |
}, | |
{ | |
"firstName": "jay", |
This file contains hidden or 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
// load the MySQL driver. Alternatively, use the Maven http://mvnrepository.com/artifact/mysql/mysql-connector-java/5.1.33 | |
Class.forName("com.mysql.jdbc.Driver"); | |
// connect to database named openstack_projects on port 3306 | |
String url = "jdbc:mysql://localhost:3306/openstack_projects"; | |
Connection conn = DriverManager.getConnection(url, "root", ""); | |
// make a query | |
String sql = "select * from projects"; | |
PreparedStatement preparedStatement = conn.prepareStatement(sql); |
This file contains hidden or 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
// create file: | |
sudo vim /usr/share/applications/intellij.desktop | |
// add the following | |
[Desktop Entry] | |
Version=13.0 | |
Type=Application | |
Terminal=false | |
Icon[en_US]=/home/daniel/idea-IC-135.690/bin/idea.png | |
Name[en_US]=IntelliJ |
This file contains hidden or 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
def z_score(n, l): | |
mean = sum(l) / len(l) | |
return (n - mean) / (stddev(l) / math.sqrt(len(l))) |