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
// Parsing | |
Node* root = 0; | |
map<string, Node*> nodes; //container of all nodes, choose map for easy query | |
vector<Edge*> edges; | |
vector<Node*> primary_inputs; | |
vector<Node*> primary_outputs; | |
string str = ""; | |
while (getline(delay_file, str)) { | |
stringstream ss(str); | |
string tmp = ""; |
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
StageName = function(game) {}; | |
(function() { | |
StageName.prototype = { | |
preload: function() { | |
}, | |
create: function() { | |
}, |
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
cell*** ptr_two_d_array = new cell**[m]; | |
for (int i = 0; i < m; ++i) { | |
cell[i] = new cell*[n]; | |
for (int j = 0; j < n; ++j) { | |
cell[i][j] = new cell(args...); | |
} | |
} |
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
#!/usr/bin/env bash | |
if [ "$1" = "" ]; then | |
echo "Please specify the number of holes" | |
echo "Usage: $0 NUMBER_OF_HOLES" | |
exit | |
fi | |
num_holes="$1" | |
num_pigeons="$(($1 + 1))" |
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
EXE = mp | |
CXX = clang++ | |
CXXFLAGS = -std=c++11 -O2 -Wall | |
CPPS := $(wildcard src/*.cpp) | |
OBJS := $(addprefix obj/,$(notdir $(CPPS:.cpp=.o))) | |
.PHONY: all clean | |
all: obj $(EXE) |
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
#!/usr/bin/env bash | |
timedatectl set-ntp true | |
gdisk /dev/sda | |
mkfs.vfat /dev/sda1 | |
mkfs.ext4 /dev/sda2 | |
mount /dev/sda2 /mnt |
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
#include <ctime> | |
#include <iostream> | |
#include <vector> | |
using namespace std; | |
// Assumption: Initializing a vector with size before assignments runs faster | |
// then filling it by "push_back"s. | |
int main() { |
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
#!/usr/bin/env python | |
# l: final length | |
# e: epsilon | |
# d: lambda | |
# u: mu | |
# dd: derivative of lambda | |
from mpmath import * |
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
// Fisher-Yates shuffle algorithm | |
function shuffle(arr) { | |
const result = [...arr]; | |
for (let i = result.length - 1; i >= 0; i -= 1) { | |
const j = Math.floor(Math.random() * (i + 1)); | |
[result[i], result[j]] = [result[j], result[i]]; | |
} | |
return result; | |
} |
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/env bash | |
# For example, iterate over files in the home directory. | |
dir=~ | |
for f in $dir/*; do | |
echo $f | |
done |
OlderNewer