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
function sort(list) { | |
if (list.length == 1) { | |
return list; | |
} | |
var listA = sort(list.slice(0, list.length / 2)) | |
var listB = sort(list.slice(list.length / 2)) | |
var indexA = 0 | |
var indexB = 0 | |
var newList = [] | |
while (indexA < listA.length || indexB < listB.length) { |
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 | |
if [ "$1" == "." ]; then | |
REPO_NAME=$(basename $PWD) | |
echo "creating $REPO_NAME repo on github" | |
git init . | |
curl -u "$(git config user.name)" https://api.github.com/user/repos -d '{"name":"'$REPO_NAME'"}' | |
elif [[ $# -gt 0 && "$1" != "-h" ]]; then | |
echo "creating $1 repo on github" | |
curl -u "$(git config user.name)" https://api.github.com/user/repos -d '{"name":"'$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
#!/bin/sh | |
echo "Running SwiftLint" | |
cd Sto | |
FILE_NAME=$(basename $PWD) | |
echo "running swiftlint in $FILE_NAME" | |
Swiftlint --strict | |
if [ $? != 0 ] ; then | |
echo "swiftlint failed make required changes to your code" | |
exit 1 | |
fi |
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
(defn addition_of_numbers [array] | |
(reduce + array)) | |
;-------------------------------------- | |
(defn added_num_at_start [array num] | |
(cons num array)) | |
;-------------------------------------- | |
(defn calculated_value [operation num1 num2] | |
(cond-> num1 | |
(= "add" operation) (+ num2) | |
(= "sub" operation) (- num2) |
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
(refer 'clojure.set :only '[rename-keys]) | |
(require '[clojure.string :as str]) | |
; -------------------Creating the map--------------- | |
(def person {:name "any" :age 12}) | |
(:name person) | |
(:age person) | |
(def train {:engine "train Engine" :containers ["first" "second" "third"]}) | |
(:containers train) |
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
import IPython | |
name = 'my_python' | |
#define functions | |
def my_fun(): | |
print('do something') | |
IPython.embed() |
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
df.apply(lambda x: x.str.strip) | |
df.loc[df["column_name"] == "value", "column_to_changed"] = 'new_value' | |
df.reanme(columns={'old_column_name':'new_colmn_name'}) | |
df['column_name'].fillna('value',inplace=True) |
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
from astropy.io import fits | |
import sys | |
import matplotlib.pyplot as plt | |
data = fits.open(str(sys.argv[1]))[0].data | |
plt.imshow(data[0][0]) | |
plt.show() |
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
import pandas as pd | |
from sklearn import tree,model_selection | |
df = pd.read_csv('path/to/csv') | |
target = df["target_column_name"].values | |
feature_names = ['columns','with','which','decision','is','to','be','made'] | |
features = df[feature_names].values | |
visual_tree = tree.DecisionTreeClassifier(random_state=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
let collector = function(collection){return (unit)=>{collection.push(unit)}} | |
let collectionA = [] | |
collectorForA=collector(collectionA) | |
collectorForA(1) |
OlderNewer