Skip to content

Instantly share code, notes, and snippets.

View sanikamal's full-sized avatar

Sani Kamal sanikamal

View GitHub Profile
@sanikamal
sanikamal / difference_time.py
Created August 3, 2020 09:14
Difference of times in seconds
# Difference of times in seconds
hours1 = int(input())
minutes1 = int(input())
seconds1 = int(input())
hours2 = int(input())
minutes2 = int(input())
seconds2 = int(input())
total_sec1=(hours1*60*60)+(minutes1*60)+seconds1
total_sec2=(hours2*60*60)+(minutes2*60)+seconds2
@sanikamal
sanikamal / data.csv
Created May 30, 2020 10:32
Implement the perceptron algorithm to separate the following data
0.78051 -0.063669 1
0.28774 0.29139 1
0.40714 0.17878 1
0.2923 0.4217 1
0.50922 0.35256 1
0.27785 0.10802 1
0.27527 0.33223 1
0.43999 0.31245 1
0.33557 0.42984 1
0.23448 0.24986 1
@sanikamal
sanikamal / pp_loop.py
Created May 13, 2020 09:11
pprint and for loop
import pprint
sales_data = [{"id":1,"email":"isidro_von@hotmail.com","first":"Torrey","last":"Veum","company":"Hilll, Mayert and Wolf","created_at":"2014-12-25T04:06:27.981Z","country":"Switzerland"},{"id":2,"email":"frederique19@gmail.com","first":"Micah","last":"Sanford","company":"Stokes-Reichel","created_at":"2014-07-03T16:08:17.044Z","country":"Democratic People's Republic of Korea"},{"id":3,"email":"fredy54@gmail.com","first":"Hollis","last":"Swift","company":"Rodriguez, Cartwright and Kuhn","created_at":"2014-08-18T06:15:16.731Z","country":"Tunisia"},{"id":4,"email":"braxton29@hotmail.com","first":"Perry","last":"Leffler","company":"Sipes, Feeney and Hansen","created_at":"2014-07-10T11:31:40.235Z","country":"Chad"},{"id":5,"email":"turner59@gmail.com","first":"Janelle","last":"Hagenes","company":"Lesch and Daughters","created_at":"2014-04-21T15:05:43.229Z","country":"Swaziland"},{"id":6,"email":"halie47@yahoo.com","first":"Charity","last":"Bradtke","company":"Gorczany-Monahan","created_at":"2014-09-2
@sanikamal
sanikamal / sum_avg.py
Created May 13, 2020 09:07
Python Program to find sum and average of three number
a = input('Enter 1st Number : ')
b = input('Enter 2nd Number : ')
c = input('Enter 3rd Number : ')
a = int(a)
b = int(b)
c = int(c)
sum = a + b + c
avg = sum / 3
@sanikamal
sanikamal / num_arr.py
Created May 13, 2020 09:05
Numpy Array Example
import numpy as np
array_a = np.array([1,2,3,4,5])
print(array_a)
# print([1,2,3,4,5, 'sani'])
print(array_a.shape)
array_b = np.array([[1,2,3,4,5],[1,2,3,4,5]])
import tensorflow as tf
W = tf.Variable(tf.ones(shape=(3,3)), name="W")
b = tf.Variable(tf.zeros(shape=(3)), name="b")
@tf.function
def model(x):
return W * x + b
out_a = model([1,0,1])
print(out_a)
@sanikamal
sanikamal / aitkens_arr.py
Last active February 28, 2020 05:03
Python program to print the Aitken’s array upto n number
# Python program to print the Aitken’s array upto n
# Input: 6
# Output:
# [1]
# [1, 2]
# [2, 3, 5]
# [5, 7, 10, 15]
# [15, 20, 27, 37, 52]
# [52, 67, 87, 114, 151, 203]
@sanikamal
sanikamal / mouse_click.js
Created December 31, 2019 08:24
Disable right click on web page
function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
@sanikamal
sanikamal / main.js
Created December 20, 2019 17:29
Chaining Async Functions | JavaScript Example
const timeUserRequest = async () => {
const before = await getCurrentTimeAsync()
await getUserDataViaHttp()
const after = await getCurrentTimeAsync()
return (after - before)
};
@sanikamal
sanikamal / App_Http_VideoStream.php
Created December 17, 2019 07:46 — forked from vluzrmos/App_Http_VideoStream.php
Laravel VideoStream.
<?php
namespace App\Http;
/**
* Description of VideoStream
*
* @author Rana
* @link https://gist.github.com/vluzrmos/d5682ad426525196d069
*/