Skip to content

Instantly share code, notes, and snippets.

function getPathTo(element) {
if (element.id!=='')
return 'id("'+element.id+'")';
if (element===document.body)
return element.tagName;
var ix= 0;
var siblings= element.parentNode.childNodes;
for (var i= 0; i<siblings.length; i++) {
var sibling= siblings[i];
@s-janibekova
s-janibekova / Untitled.ipynb
Created March 22, 2021 12:26
Created on Skills Network Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@s-janibekova
s-janibekova / Untitled.ipynb
Created March 21, 2021 12:34
Created on Skills Network Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@s-janibekova
s-janibekova / Untitled.ipynb
Created March 21, 2021 12:34
Created on Skills Network Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@s-janibekova
s-janibekova / short_version.py
Created November 8, 2020 06:17 — forked from miloharper/short_version.py
A neural network in 9 lines of Python code.
from numpy import exp, array, random, dot
training_set_inputs = array([[0, 0, 1], [1, 1, 1], [1, 0, 1], [0, 1, 1]])
training_set_outputs = array([[0, 1, 1, 0]]).T
random.seed(1)
synaptic_weights = 2 * random.random((3, 1)) - 1
for iteration in xrange(10000):
output = 1 / (1 + exp(-(dot(training_set_inputs, synaptic_weights))))
synaptic_weights += dot(training_set_inputs.T, (training_set_outputs - output) * output * (1 - output))
print 1 / (1 + exp(-(dot(array([1, 0, 0]), synaptic_weights))))
@s-janibekova
s-janibekova / bash_usefull_scrits
Last active October 29, 2020 09:17
bash_scirpts_for_userfull_tasks.sh
# Rename files from .HTM --> .html
#!/bin/bash
for file in *.HTM; do
name=$(basename "$file" .HTM)
mv "$file" "$name.html"
done
-----------------------------------------------------------------
@s-janibekova
s-janibekova / Filtering Log Files with Regular Expressions
Created October 28, 2020 07:50 — forked from allooshcode/Filtering Log Files with Regular Expressions
We're using the same syslog, and we want to display the date, time, and process id that's inside the square brackets. We can read each line of the syslog and pass the contents to the show_time_of_pid function. Fill in the gaps to extract the date, time, and process id from the passed line, and return this format: Jul 6 14:01:23 pid:29440.
import re
def show_time_of_pid(line):
pattern = r'^(\w+ [0-9] [0-9]+:[0-9]+:[0-9]+) [\w\.]+ [\w=]+\[([0-9]+)\]'
result = re.search(pattern, line)
return '{} pid:{}'.format(result[1],result[2])
print(show_time_of_pid("Jul 6 14:01:23 computer.name CRON[29440]: USER (good_user)")) # Jul 6 14:01:23 pid:29440
print(show_time_of_pid("Jul 6 14:02:08 computer.name jam_tag=psim[29187]: (UUID:006)")) # Jul 6 14:02:08 pid:29187
@s-janibekova
s-janibekova / Q4.py
Created October 26, 2020 14:30 — forked from RabeyaMuna/Q4.py
The parent_directory function returns the name of the directory that's located just above the current working directory. Remember that '..' is a relative path alias that means "go up to the parent directory". Fill in the gaps to complete this function.
import os
def parent_directory():
# Create a relative path to the parent
# of the current working directory
relative_parent = os.path.join(os.getcwd(), os.pardir)
# Return the absolute path of the parent directory
return os.path.abspath(relative_parent)
print(parent_directory())
@s-janibekova
s-janibekova / understanding-word-vectors.ipynb
Created October 1, 2020 08:51 — forked from aparrish/understanding-word-vectors.ipynb
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@s-janibekova
s-janibekova / mergesort.py
Created January 5, 2020 07:40 — forked from femmerling/mergesort.py
Merge Sort written in python.
def merge_lists(left_sublist,right_sublist):
i,j = 0,0
result = []
#iterate through both left and right sublist
while i<len(left_sublist) and j<len(right_sublist):
#if left value is lower than right then append it to the result
if left_sublist[i] <= right_sublist[j]:
result.append(left_sublist[i])
i += 1
else: