Skip to content

Instantly share code, notes, and snippets.

View kaskichandrakant's full-sized avatar

Chandrakant Kaski kaskichandrakant

View GitHub Profile
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) {
#!/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'"}'
#!/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
(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)
(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)
import IPython
name = 'my_python'
#define functions
def my_fun():
print('do something')
IPython.embed()
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)
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()
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
let collector = function(collection){return (unit)=>{collection.push(unit)}}
let collectionA = []
collectorForA=collector(collectionA)
collectorForA(1)