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
| all: | |
| java -cp ~/antlr-4.6-complete.jar:. org.antlr.v4.Tool -no-listener -no-visitor *.g4 | |
| javac -cp ~/antlr-4.6-complete.jar:. *.java | |
| run: | |
| java -cp ~/antlr-4.6-complete.jar:. ParseFile inputfile | |
| clean: |
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 | |
| import numpy as np | |
| df = pd.read_csv('data/train.csv') | |
| df = df.drop(['Name', 'Ticket', 'Cabin'], axis=1) | |
| ########################################################### | |
| # 1. We need to fill the NaN values rather than drop them | |
| # Improvments go here for training | |
| ########################################################### |
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
| all: | |
| antlr4 -no-listener -no-visitor *.g4 | |
| javac *.java | |
| run: | |
| @java -cp C:\libs\antlr-4.5.2-complete.jar;. ExprParser < inputfile | |
| clean: | |
| del *.java *.tokens *.class |
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 java.util.regex.*; | |
| import static java.lang.System.out; | |
| class Demo1 { | |
| public static void main(String[] args) { | |
| String pattern_string = args[0]; | |
| String content_string = args[1]; | |
| Pattern pattern = Pattern.compile(pattern_string); | |
| Matcher matcher = pattern.matcher(content_string); |
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 numpy as np | |
| import networkx as nx | |
| import matplotlib.pyplot as plt | |
| # This wonderful bellman-ford algorithm is brought | |
| # to you by https://gist.github.com/joninvski/701720 | |
| # Step 1: For each node prepare the destination and predecessor | |
| def initialize(graph, source): | |
| d = {} # Stands for destination |
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 matplotlib.pyplot as plt | |
| with open('runtime.txt') as f: | |
| runtimes = [int(line.strip()) for line in f] | |
| plt.hist(runtimes) | |
| plt.savefig('runtime.png') | |
| plt.show() |
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
| prepare: | |
| javac World/Person.java | |
| javac World/Community.java | |
| n ?= 10 | |
| run: | |
| n=$(n); \ | |
| while [ $${n} -gt 0 ] ; do \ | |
| echo $$n ; \ | |
| n=`expr $$n - 1`; \ |
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 java.util.Arrays; | |
| /* | |
| * | |
| Insertion sort algorithm | |
| for j = 2 to A.length | |
| key = A[j] | |
| i = j-1 |
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 java.util.Arrays; | |
| /* | |
| * | |
| Insertion sort algorithm | |
| for j = 2 to A.length | |
| key = A[j] | |
| i = j-1 |