Skip to content

Instantly share code, notes, and snippets.

View empeje's full-sized avatar
:octocat:
Focusing

Abdurrachman M empeje

:octocat:
Focusing
View GitHub Profile
from pylab import *
from math import log
def fitExponent(tList,yList,ySS=0):
'''
This function finds a
tList in sec
yList - measurements
ySS - the steady state value of y
returns
@empeje
empeje / hackerrank_kangaroo.py
Last active December 17, 2017 11:15
[SNIPPET-23] HackerRank - Kangaroo
#!/bin/python3
import sys
def is_odd(integer):
if integer % 2 == 0:
return False
else:
return True
@empeje
empeje / hackerrank_betweentwosets.py
Last active December 17, 2017 11:15
[SNIPPET-22] HackerRank - Between Two Sets (Ugly Solution)
#!/bin/python3
import sys
from functools import reduce
n,m = input().strip().split(' ')
n,m = [int(n),int(m)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
b = [int(b_temp) for b_temp in input().strip().split(' ')]
@empeje
empeje / hackerrank_divisiblesumpairs.py
Last active December 17, 2017 11:14
[SNIPPET-21] HackerRank - Divisible Sum Pairs
#!/bin/python3
import sys
import itertools
n,k = input().strip().split(' ')
n,k = [int(n),int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
combinations = list(itertools.combinations(a, 2))
@empeje
empeje / hackerrank_breakingtherecords.py
Last active December 17, 2017 11:14
[SNIPPET-20] HackerRank - Breaking the Records
#!/bin/python3
import sys
n = int(input().strip())
scores = list(map(int, input().strip().split(' ')))
# your code goes here
# highest score
max = -float("inf")
@empeje
empeje / codility_binarygap.py
Last active December 17, 2017 11:13
[SNIPPET-19] Codility - Binary Gap
def solution(N):
# write your code in Python 2.7
bin_representation = "{0:b}".format(N)
bin_representation = 'x' + bin_representation
bin_representation = bin_representation + 'x'
start_index = [i for i in range(0, len(bin_representation)) if ((bin_representation[i] == '1') and (bin_representation[i+1]=='0'))]
end_index = [i for i in range(0, len(bin_representation)) if ((bin_representation[i] == '1') and (bin_representation[i-1]=='0'))]
print(start_index)
@empeje
empeje / codility_cyclicrotation.py
Last active December 17, 2017 11:13
[SNIPPET-18] Codility - Cyclic Rotation
from collections import deque
# you can write to stdout for debugging purposes, e.g.
# print "this is a debug message"
def solution(A, K):
# write your code in Python 2.7
d=deque(A)
d.rotate(K)
return list(d)
@empeje
empeje / codility_frogjump.py
Last active December 17, 2017 11:13
[SNIPPET-17] Codility - Frog Jump
def solution(X, Y, D):
# write your code in Python 2.7
gap = Y-X
if gap % D == 0:
return gap / D
else:
return gap / D + 1
@empeje
empeje / database_command.txt
Last active December 17, 2017 11:12
[SNIPPET-16] Ubuntu Linux Command for Most Dabases
sudo apt-get install redis-server
sudo /etc/init.d/redis-server restart
neo4j start
neo4j status
sudo apt-get install mongodb-server
sudo apt-get install mongodb-clients
killall mongod
cd ~
@empeje
empeje / README.md
Last active June 4, 2019 12:58
Vagrant Must-Know Commands (WIP)

List of Vagrant commands

vagrant plugin install vagrant-vbguest