text stringlengths 0 1.05M | meta dict |
|---|---|
#!/bin/python3
import sys
n = int(input().strip())
unsorted = []
unsorted_i = 0
for unsorted_i in range(n):
unsorted_t = str(input().strip())
unsorted.append(unsorted_t)
# your code goes here
unsorted.sort(key=int)
for i in range(n):
print(unsorted[i])
# Important concept to avoid conversions to avoid runtim... | {
"repo_name": "saisankargochhayat/algo_quest",
"path": "hackerrank_algorithm_path/Sorting/big-sorting.py",
"copies": "1",
"size": "2560",
"license": "apache-2.0",
"hash": 1798092584762953500,
"line_mean": 64.6666666667,
"line_max": 407,
"alpha_frac": 0.73359375,
"autogenerated": false,
"ratio": 3... |
#!/bin/python3
import sys
class PythagoreanTriplet(object):
def __init__(self, n):
self.n = n
def maximum_abc(self):
m, n = self.find_triplet()
# print("m is:", m)
# print("n is:", n)
if(m):
return self.product_of_abc(m, n)
else:
retur... | {
"repo_name": "rootulp/hackerrank",
"path": "python/euler009.py",
"copies": "1",
"size": "1188",
"license": "mit",
"hash": 8313613553903213000,
"line_mean": 23.2448979592,
"line_max": 78,
"alpha_frac": 0.4654882155,
"autogenerated": false,
"ratio": 3.1595744680851063,
"config_test": false,
"h... |
#!/bin/python3
import sys
def circularWalk(n, s, t, r_0, g, seed, p):
# Complete this function
if s == t:
return 0
r = [r_0]
for q in range(1,n):
r.append(((r[q-1]*g)+seed) % p)
visited = []
currentPoints = [s]
steps = 0
#When t is in visited, stop
w... | {
"repo_name": "Chuck8521/LunchtimeBoredom",
"path": "woc32p3.py",
"copies": "1",
"size": "1288",
"license": "mit",
"hash": -5609189157640539000,
"line_mean": 24.76,
"line_max": 98,
"alpha_frac": 0.5,
"autogenerated": false,
"ratio": 3.5482093663911844,
"config_test": false,
"has_no_keywords":... |
#!/bin/python3
import sys
def solution(hrs, min):
lookup = {
0: 'zero',
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five',
6: 'six',
7: 'seven',
8: 'eight',
9: 'nine',
10: 'ten',
11: 'eleven',
12: 'twelve',... | {
"repo_name": "lilsweetcaligula/Online-Judges",
"path": "hackerrank/algorithms/implementation/medium/the_time_in_words/py/solution.py",
"copies": "1",
"size": "1388",
"license": "mit",
"hash": 9149654143082805000,
"line_mean": 22.1333333333,
"line_max": 106,
"alpha_frac": 0.431556196,
"autogenerate... |
#!/bin/python3
import sys
# t = int(input().strip())
# for a0 in range(t):
# G = [
# "7283455864",
# "6731158619",
# "8988242643",
# "3830589324",
# "2229505813",
# "5633845374",
# "6473530293",
# "7053106601",
# "0834282956",
# "4607924137"
# ]
# P = ["9505", "3845", "3530"]
G... | {
"repo_name": "piotrbla/pyExamples",
"path": "gridSearch.py",
"copies": "1",
"size": "1529",
"license": "mit",
"hash": 1073304391270690400,
"line_mean": 21.8208955224,
"line_max": 97,
"alpha_frac": 0.4009156311,
"autogenerated": false,
"ratio": 3.4829157175398633,
"config_test": false,
"has_n... |
#!/bin/python3
import yaml
import json
import jinja2
import jsonschema
import re
import argparse
import sys
from collections import OrderedDict
# This schema describes what we expect interface definition files to look like
validator = jsonschema.Draft4Validator(yaml.safe_load("""
definitions:
interface:
type: o... | {
"repo_name": "madcowswe/ODriveFirmware",
"path": "Firmware/fibre/tools/interface_generator.py",
"copies": "1",
"size": "28683",
"license": "mit",
"hash": -5058623995096715000,
"line_mean": 40.8119533528,
"line_max": 215,
"alpha_frac": 0.5926855629,
"autogenerated": false,
"ratio": 3.630759493670... |
#!/bin/python3
# Interactive script to run a segmentation and medial axis loop using pyroots.
# Steps:
# 1. Copy this script to the directory you want to work in.
# - images and settings should be in a child directory!
# 2. Open your terminal and navigate to the working directory (ex. with `cd "path_to_dire... | {
"repo_name": "pme1123/pyroots",
"path": "Command Line Scripts/Batch Preprocessing.py",
"copies": "1",
"size": "2537",
"license": "apache-2.0",
"hash": -1324362632760947200,
"line_mean": 27.5056179775,
"line_max": 98,
"alpha_frac": 0.5254237288,
"autogenerated": false,
"ratio": 3.9702660406885757... |
#!/bin/python3
#l = [int(x) for x in input().split()]
elements = list(map(int, input().split()))
class Node:
def __init__(self, data):
self.right = None
self.left = None
self.data= data
def insert_node (node, data):
if node == None:
return True
parent = None
if data > node.d... | {
"repo_name": "chenthillrulz/fun_with_python",
"path": "binary_search_tree.py",
"copies": "1",
"size": "1643",
"license": "apache-2.0",
"hash": 5576101097442959000,
"line_mean": 21.5068493151,
"line_max": 107,
"alpha_frac": 0.5897748022,
"autogenerated": false,
"ratio": 2.928698752228164,
"conf... |
"""
Author: @pme1123
Created: August 6th, 2017
Contents:
neighborhod_filter - Filters candidate objects based on pixels near them
"""
from scipy import ndimage
import numpy as np
from skimage import img_as_float, measure, morphology, color
from pyroots.image_manipulation import img_split
def neighborhood_filter(im... | {
"repo_name": "pme1123/pyroots",
"path": "pyroots/neighborhood_filter.py",
"copies": "1",
"size": "5948",
"license": "apache-2.0",
"hash": -3803647903329054700,
"line_mean": 37.8758169935,
"line_max": 128,
"alpha_frac": 0.5304303968,
"autogenerated": false,
"ratio": 3.8723958333333335,
"config_... |
"""
Author: @pme1123
Created: Jan 17th, 2017
Frangi Segmentation - combines various functions into a single one for convenience
Frangi Image Loop - For series analysis across directories.
"""
import os
import pandas as pd
from pyroots import *
from skimage import io, color, filters, morphology, img_as_ubyte, img_a... | {
"repo_name": "pme1123/pyroots",
"path": "pyroots/frangi_segmentation.py",
"copies": "1",
"size": "12341",
"license": "apache-2.0",
"hash": -2081785856983351600,
"line_mean": 34.5648414986,
"line_max": 129,
"alpha_frac": 0.5749939227,
"autogenerated": false,
"ratio": 3.970720720720721,
"config_... |
#!/bin/python3
'''
Binary Search Tree : Lowest Common Ancestor
https://www.hackerrank.com/challenges/binary-search-tree-lowest-common-ancestor/problem
'''
class Node:
def __init__(self, info):
self.info = info
self.left = None
self.right = None
self.level = None
def __s... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/tree/lowest-common-ancestor.py",
"copies": "1",
"size": "1874",
"license": "mit",
"hash": -2912696501713500000,
"line_mean": 23.3376623377,
"line_max": 87,
"alpha_frac": 0.4994663821,
"autogenerated": false,
"ratio": 3.8559670781893005,
"conf... |
#!/bin/python3
# bisect - https://docs.python.org/3.6/library/bisect.html
# heapq - https://docs.python.org/3/library/heapq.html
from heapq import heappush, heappop
import unittest
class Heap:
def __init__(self, max_heap=False):
self.max_heap = max_heap
self._heap = []
def push(self, val):... | {
"repo_name": "MFry/pyAlgoDataStructures",
"path": "hacker_rank/Cracking the coding interview challenge/heaps_find_the_running_median.py",
"copies": "1",
"size": "3065",
"license": "mit",
"hash": -1466647392219657700,
"line_mean": 27.119266055,
"line_max": 96,
"alpha_frac": 0.5654159869,
"autogener... |
#!/bin/python3
class Person:
def __init__(self, firstName, lastName, idNumber):
self.firstName = firstName
self.lastName = lastName
self.idNumber = idNumber
def printPerson(self):
print("Name:", self.lastName + ",", self.firstName)
print("ID:", self.idNumber)
class ... | {
"repo_name": "jerryasher/hackerrank30",
"path": "12/scores.py",
"copies": "1",
"size": "1107",
"license": "unlicense",
"hash": 2271019565516032500,
"line_mean": 22.5531914894,
"line_max": 62,
"alpha_frac": 0.5618789521,
"autogenerated": false,
"ratio": 3.5825242718446604,
"config_test": false,... |
#!/bin/python3
class Solution:
def __init__(self):
self.stack = []
self.queue = []
def pushCharacter(self, ch):
self.stack.append(ch)
def popCharacter(self):
ch = self.stack.pop()
return ch
def enqueueCharacter(self, ch):
self.queue.append(ch)
d... | {
"repo_name": "jerryasher/hackerrank30",
"path": "18/palindrome.py",
"copies": "1",
"size": "1060",
"license": "unlicense",
"hash": 3611165390085364000,
"line_mean": 20.2,
"line_max": 54,
"alpha_frac": 0.6273584906,
"autogenerated": false,
"ratio": 3.486842105263158,
"config_test": false,
"ha... |
'''
Copyright (c) 2017, Corey Edwards. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the followin... | {
"repo_name": "cedwardsmedia/everyoneapi.py",
"path": "everyoneapi.py",
"copies": "1",
"size": "3637",
"license": "bsd-3-clause",
"hash": -6588499720485017000,
"line_mean": 46.8552631579,
"line_max": 755,
"alpha_frac": 0.7387957108,
"autogenerated": false,
"ratio": 3.957562568008705,
"config_te... |
#!/bin/python3
def stock_purchase_day(stock_prices, price, purchase_buckets):
begin = None
end = None
for bucket_begin, bucket_end, min_bucket_value in purchase_buckets:
if min_bucket_value <= price:
begin, end = bucket_begin, bucket_end
break
if begin is None:
... | {
"repo_name": "avenet/hackerrank",
"path": "contests/moodys_analytics_fall_university_codesprint/stock_purchase_day.py",
"copies": "1",
"size": "1162",
"license": "mit",
"hash": -1699817110561752300,
"line_mean": 20.1272727273,
"line_max": 71,
"alpha_frac": 0.5851979346,
"autogenerated": false,
"... |
#!/bin/python3
'''
Find Merge Point of Two Lists
https://www.hackerrank.com/challenges/find-the-merge-point-of-two-joined-linked-lists/problem
'''
import math
import os
import random
import re
import sys
class SinglyLinkedListNode:
def __init__(self, node_data):
self.data = node_data
self.next =... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/tree/find-merge-point.py",
"copies": "1",
"size": "2276",
"license": "mit",
"hash": -5814587282470876000,
"line_mean": 19.7,
"line_max": 93,
"alpha_frac": 0.5496485062,
"autogenerated": false,
"ratio": 3.361890694239291,
"config_test": false,... |
#!/bin/python3
#initialize and scan for cards
# 1 Addr x XOR
#always use bcast addr
def setup(ser):
print("Setup: Emptying card buffers")
readanddiscard(ser)
command=1
addr=1
data =0
xor=command^addr^data
toSend= bytes([command, addr, data, xor])
ser.write(toSend)
return parseSetu... | {
"repo_name": "SebastianSchildt/potatonet-power",
"path": "relaiscommands.py",
"copies": "1",
"size": "4509",
"license": "mit",
"hash": -4499012055818689000,
"line_mean": 23.7747252747,
"line_max": 89,
"alpha_frac": 0.5786205367,
"autogenerated": false,
"ratio": 3.5729001584786055,
"config_test... |
#!/bin/python3
"""
Knapsack without repetitions, for items with 1:1 weight:value ratio
What optimizations are available for value equivalent to weight?
"""
def main():
maximum = int(input().split()[0])
weights = [ int(i) for i in input().split() ]
print(optimal_weight_matrix(maximum, weights))
def opti... | {
"repo_name": "rmsr/misc",
"path": "coursera/algorithmic-toolbox/week5/knapsack.py",
"copies": "1",
"size": "1496",
"license": "isc",
"hash": 6683525273561916000,
"line_mean": 32.2444444444,
"line_max": 77,
"alpha_frac": 0.6056149733,
"autogenerated": false,
"ratio": 3.7493734335839597,
"config... |
#!/bin/python3
"""
Multiple-feature closed-form linear regression in pure python
This is unlikely to be fast on nontrivial datasets. Still pretty cool though.
"""
def invert(A):
# filched from http://www.alphasheep.co.za/2015/06/on-matrix-inversion-in-python.html
A = [A[i]+[int(i==j) for j in range(len(A)... | {
"repo_name": "rmsr/misc",
"path": "hackerrank/intro-to-statistics/predicting-house-prices.py",
"copies": "1",
"size": "1460",
"license": "isc",
"hash": 2955692125976475600,
"line_mean": 35.5,
"line_max": 108,
"alpha_frac": 0.5876712329,
"autogenerated": false,
"ratio": 2.786259541984733,
"conf... |
#!/bin/python3
# Note this solution times out on test case 9 with Python3.
# However, this solution passes test case 9 with Pypy3.
from collections import deque
class CastleOnGrid:
CELL_BLOCKED_TOKEN = 'X'
def __init__(self, grid, grid_size, start, goal):
self.grid = grid
self.grid_size = ... | {
"repo_name": "rootulp/hackerrank",
"path": "python/castle-on-the-grid.py",
"copies": "1",
"size": "2578",
"license": "mit",
"hash": -7635151080725890000,
"line_mean": 28.976744186,
"line_max": 77,
"alpha_frac": 0.5170674942,
"autogenerated": false,
"ratio": 3.7690058479532165,
"config_test": f... |
#!/bin/python3
"""
peak.py
Given a folder of background counts and spectrum measurements, process, for each wavelength, the mean and standard deviation. (Assumes each data point is gaussian)
Plots and then fits a given section of the spectrum to a gaussian.
~yd
2016-01-04
"""
import argparse
import numpy as np
impo... | {
"repo_name": "sunjerry019/photonLauncher",
"path": "oceanoptics/process/peak.py",
"copies": "1",
"size": "7404",
"license": "apache-2.0",
"hash": 9150429593346320000,
"line_mean": 38.8064516129,
"line_max": 163,
"alpha_frac": 0.5343057807,
"autogenerated": false,
"ratio": 3.5768115942028986,
"... |
#!/bin/python3
"""
Place parentheses in a list of integers and math ops to maximize value
Ops are add, sub, mult
"""
import operator
import re
ops_table = { '+': operator.add, '-': operator.sub, '*': operator.mul }
def main():
expression = input()
data = [ int(i) for i in re.findall('\d+', expression) ]
... | {
"repo_name": "rmsr/misc",
"path": "coursera/algorithmic-toolbox/week5/placing_parentheses.py",
"copies": "1",
"size": "1308",
"license": "isc",
"hash": -4092936642494780400,
"line_mean": 26.829787234,
"line_max": 71,
"alpha_frac": 0.4854740061,
"autogenerated": false,
"ratio": 3.0849056603773586... |
#!/bin/python3
"""
points.py
Given a folder of background counts and spectrum measurements, parse and then concatenates each wavelength into a data over time
~yd
2016-01-04
"""
import argparse
import numpy as np
import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils
import os, sys
import re
import datetime
import tim... | {
"repo_name": "sunjerry019/photonLauncher",
"path": "oceanoptics/process/points.py",
"copies": "1",
"size": "4650",
"license": "apache-2.0",
"hash": 4507105682485402600,
"line_mean": 32.9416058394,
"line_max": 128,
"alpha_frac": 0.5062365591,
"autogenerated": false,
"ratio": 3.820870994248151,
... |
#!/bin/python3
"""
Primitive calculator
Given ops *3, *2, +1, what is the fewest ops to reach n from 1?
"""
import os
import sys
def main():
sequence = optimal_sequence_linear(int(input()))
print(len(sequence) - 1)
print(*sequence)
def optimal_sequence_linear(n):
"""
Solve by calculating min-st... | {
"repo_name": "rmsr/misc",
"path": "coursera/algorithmic-toolbox/week5/primitive_calculator.py",
"copies": "1",
"size": "2044",
"license": "isc",
"hash": 2066986643733704700,
"line_mean": 22.7674418605,
"line_max": 78,
"alpha_frac": 0.481409002,
"autogenerated": false,
"ratio": 3.663082437275986,... |
#! /bin/python3
"""
# Purpose
To batch process raw fastq files for adaptor trimming and QC trimming
with trimmomatic.
basedir is the top level output dir
inputdirectory should contain all folders with .fastq.gz reads to be processed
processed is where the trimmed read files will go
log is self explanatory
trim is dir... | {
"repo_name": "samleenz/rnaseq_pipe",
"path": "batch_trim.py",
"copies": "1",
"size": "3533",
"license": "mit",
"hash": -5534403477418555000,
"line_mean": 30.2654867257,
"line_max": 147,
"alpha_frac": 0.6142088876,
"autogenerated": false,
"ratio": 3.420135527589545,
"config_test": false,
"has... |
#!/bin/python3
"""
Random tester, for Cassius.
Uses Selenium Webdriver to test assertions on web pages.
"""
from selenium import webdriver
import capture
import os, sys
import warnings
import random
import itertools
try:
import urllib.parse as parse
except:
import urlparse as parse
import argparse
def all_p... | {
"repo_name": "uwplse/Cassius",
"path": "capture/test.py",
"copies": "1",
"size": "2700",
"license": "mit",
"hash": 6401794747311910000,
"line_mean": 31.5301204819,
"line_max": 106,
"alpha_frac": 0.5440740741,
"autogenerated": false,
"ratio": 3.8297872340425534,
"config_test": true,
"has_no_k... |
#!/bin/python3
"""
Screenshot taker, for Cassius.
Uses Selenium Webdriver to take screenshots of web pages.
"""
from selenium import webdriver
import os, sys
import warnings
try:
import urllib.parse as parse
except:
import urlparse as parse
import argparse
def make_browser():
profile = webdriver.Firefox... | {
"repo_name": "uwplse/Cassius",
"path": "capture/screenshot.py",
"copies": "1",
"size": "1785",
"license": "mit",
"hash": 6590789119588380000,
"line_mean": 30.875,
"line_max": 129,
"alpha_frac": 0.6196078431,
"autogenerated": false,
"ratio": 3.8973799126637556,
"config_test": false,
"has_no_k... |
#!/bin/python3
"""
The Orion alphabet system consists of letters, denoted by the integers from to . The Orion letter is denoted by the integer .
Some Orion letters can be transformed to other Orion letters. A transformation is denoted by a pair of two Orion letters, . Using this transformation, you can replace letter... | {
"repo_name": "ledrui/programming-problems",
"path": "hackerrank/contest_week33/transform_to_palindrom.py",
"copies": "1",
"size": "1955",
"license": "mit",
"hash": 6751091734699895000,
"line_mean": 49.1282051282,
"line_max": 356,
"alpha_frac": 0.7447570332,
"autogenerated": false,
"ratio": 3.902... |
#!/bin/python3
'''
Tree: Height of a Binary Tree
https://www.hackerrank.com/challenges/tree-height-of-a-binary-tree/problem
'''
class Node:
def __init__(self, info):
self.info = info
self.left = None
self.right = None
self.level = None
def __str__(self):
return... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/tree/height-of-tree.py",
"copies": "1",
"size": "1772",
"license": "mit",
"hash": -5542439148113580000,
"line_mean": 22.3157894737,
"line_max": 80,
"alpha_frac": 0.4841986456,
"autogenerated": false,
"ratio": 4.199052132701421,
"config_test":... |
#!/bin/python3
'''
Trees: Is This a Binary Search Tree?
https://www.hackerrank.com/challenges/ctci-is-binary-search-tree/problem
The data value of every node in a node's left subtree is less than the data value of that node.
The data value of every node in a node's right subtree is greater than the data value of tha... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/tree/check-bst.py",
"copies": "1",
"size": "1187",
"license": "mit",
"hash": -8677104251723191000,
"line_mean": 22.74,
"line_max": 99,
"alpha_frac": 0.6133108677,
"autogenerated": false,
"ratio": 3.260989010989011,
"config_test": false,
"ha... |
#!/bin/python3
'''
Problem: https://www.hackerrank.com/challenges/richie-rich
Python 3
Thoughts: Not a problem with elegant solution.
Lots of edge cases and if else's required.
First pass turning the string into palindrome by
converting mismatch digit to larger of the two mismatch digits.
marking with '-' to keep t... | {
"repo_name": "RyanFehr/HackerRank",
"path": "Algorithms/Strings/Richie Rich/solution.py",
"copies": "1",
"size": "2070",
"license": "mit",
"hash": -6458077197486782000,
"line_mean": 29.4558823529,
"line_max": 68,
"alpha_frac": 0.5425120773,
"autogenerated": false,
"ratio": 3.1797235023041477,
... |
#!/bin/python3
"""Provides an implementation of a feedfoward neural network using theano."""
##### Importing Modules #####
### Builtin Modules ###
import itertools
import random
import pickle
import collections
import abc
### Other Modules ###
import theano
import numpy
### Import Specific Functions ###
from abc impo... | {
"repo_name": "pogrmman/NeuralNet",
"path": "neuralnet.py",
"copies": "1",
"size": "25388",
"license": "mit",
"hash": -7880615403506084000,
"line_mean": 37.5250379363,
"line_max": 92,
"alpha_frac": 0.5468725382,
"autogenerated": false,
"ratio": 4.580191232184737,
"config_test": false,
"has_no... |
#!/bin/python3
#
# Provides communication with the Amazon AWS API
#
# Supported actions:
# Validate a local template
# Submit and run a local template (create a stack)
# Delete a stack
#
# Support different template types:
# AWS CloudFormation
# Default configuration and creditals will be extracted from boto3... | {
"repo_name": "magreiner/orchestration-tools",
"path": "cloud_provider/amazon.py",
"copies": "1",
"size": "7391",
"license": "apache-2.0",
"hash": -2438375862798704600,
"line_mean": 37.2953367876,
"line_max": 112,
"alpha_frac": 0.5757001759,
"autogenerated": false,
"ratio": 4.449729078868152,
"... |
#!/bin/python3
#
# Provides communication with the API of multiple cloud provider
#
# Supported actions:
# Validate a local template
# Submit and run a local template (create a stack)
# Delete a stack
#
# Supports different template types:
# AWS CloudFormation
#
# Upcoming template types
# OpenStack Heat Or... | {
"repo_name": "magreiner/orchestration-tools",
"path": "cloud_provider/__init__.py",
"copies": "1",
"size": "1458",
"license": "apache-2.0",
"hash": 5068183907954250000,
"line_mean": 30.0212765957,
"line_max": 93,
"alpha_frac": 0.6790123457,
"autogenerated": false,
"ratio": 4.238372093023256,
"... |
#!/bin/python3
"""
Python2-specific version of support functions.
"""
import abc
import os
__all__ = [
'ExistingDirectory',
'ExistingPath',
'ExistingFile',
'OpenProjectCaseInterface'
]
class OpenProjectCaseInterface(object):
"""
Interface for dispatching on the input cases.
"""
__metac... | {
"repo_name": "OaklandPeters/sublp",
"path": "sublp/py2.py",
"copies": "1",
"size": "3511",
"license": "mit",
"hash": -849406206844764300,
"line_mean": 23.2137931034,
"line_max": 83,
"alpha_frac": 0.5730561094,
"autogenerated": false,
"ratio": 4.356079404466501,
"config_test": false,
"has_no_... |
#!/bin/python3
"""
Python-3 specific version of some support functions.
"""
import abc
import os
__all__ = [
'ExistingDirectory',
'ExistingPath',
'ExistingFile',
'OpenProjectCaseInterface'
]
class OpenProjectCaseInterface(object, metaclass=abc.ABCMeta):
"""
Interface for dispatching on the in... | {
"repo_name": "OaklandPeters/sublp",
"path": "sublp/py3.py",
"copies": "1",
"size": "3292",
"license": "mit",
"hash": 2084204287380641000,
"line_mean": 24.1297709924,
"line_max": 83,
"alpha_frac": 0.5804981774,
"autogenerated": false,
"ratio": 4.3430079155672825,
"config_test": false,
"has_no... |
#!/bin/python3
# recorta el audio de una pista .wav en referencia a los frames de inicio y fin
# del video original.
# la salida puede ser elegida si se requiere el archivo .wav o diretamente los
# volcados a un archivo .csv en una sola linea.
#>>> python3 extractorWav.py an1.wav 58 112
import sys
import os
from sci... | {
"repo_name": "lerker/cupydle",
"path": "cupydle/test/kml/extractorWav.py",
"copies": "1",
"size": "1408",
"license": "apache-2.0",
"hash": -5648958614535423000,
"line_mean": 32.5238095238,
"line_max": 111,
"alpha_frac": 0.71875,
"autogenerated": false,
"ratio": 2.67680608365019,
"config_test":... |
#! /bin/python3
"""
Scheduler for running spider periodly. We have to use subprocess.call as
scrapyd do not support run multiple spider in a single call, and we want to
use different log file each time we run spider.
"""
import shutil
import time
import schedule
from subprocess import call
def movie_crawl_job():
... | {
"repo_name": "gas1121/JapanCinemaStatusSpider",
"path": "run.py",
"copies": "1",
"size": "2093",
"license": "mit",
"hash": 4555699129654049300,
"line_mean": 31.703125,
"line_max": 79,
"alpha_frac": 0.6325848065,
"autogenerated": false,
"ratio": 3.2003058103975537,
"config_test": false,
"has_... |
#!/bin/python3
# Set up chrome driver https://sites.google.com/a/chromium.org/chromedriver/getting-started
# Install xorg-x11-server-Xvfb
import requests
import bs4
import re
from bs4 import BeautifulSoup
from selenium import webdriver
from pyvirtualdisplay import Display
def get_smn():
smn = reques... | {
"repo_name": "briancurt/weathercheck",
"path": "scripts/weatherscrap.py",
"copies": "1",
"size": "1827",
"license": "mit",
"hash": 3598285157121302500,
"line_mean": 31.0175438596,
"line_max": 103,
"alpha_frac": 0.5780821918,
"autogenerated": false,
"ratio": 3.1037414965986394,
"config_test": f... |
#!/bin/python3
# take a json file and convert it to an AWS template
from template.template import CloudFormationTemplate
from pprint import pprint
from optparse import OptionParser
import sys
def parse_arguments():
parser = OptionParser(
prog="transform_template",
version="0",
usage="%pro... | {
"repo_name": "magreiner/orchestration-tools",
"path": "transform_template.py",
"copies": "1",
"size": "1130",
"license": "apache-2.0",
"hash": -3843925883946194400,
"line_mean": 27.25,
"line_max": 76,
"alpha_frac": 0.6557522124,
"autogenerated": false,
"ratio": 3.9100346020761245,
"config_test... |
#!/bin/python3
# Take a template file and upload it to AWS CloudFormation
from cloud_provider.amazon import Amazon
from optparse import OptionParser
from pprint import pprint
import sys
def parse_arguments():
parser = OptionParser(
prog="deploy_template",
version="0",
usage="%prog [option... | {
"repo_name": "magreiner/orchestration-tools",
"path": "deploy_template.py",
"copies": "1",
"size": "3841",
"license": "apache-2.0",
"hash": -2707787338904249300,
"line_mean": 32.6929824561,
"line_max": 88,
"alpha_frac": 0.6172871648,
"autogenerated": false,
"ratio": 4.099252934898613,
"config_... |
#!/bin/python3
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""Overlays two directories into a target directory using symlinks.
Tries to minimize the number of symlinks ... | {
"repo_name": "apple/llvm-project",
"path": "utils/bazel/overlay_directories.py",
"copies": "5",
"size": "3102",
"license": "apache-2.0",
"hash": -897847728569520600,
"line_mean": 32.7173913043,
"line_max": 80,
"alpha_frac": 0.6998710509,
"autogenerated": false,
"ratio": 3.8726591760299627,
"co... |
#!/bin/python3
#
# This Python 3 script allows for simple command-line interactions with a
# Couchbase server (local or remote).
import json
import sys
from argparse import ArgumentParser
from enum import Enum
import requests
from couchbase.bucket import Bucket
from couchbase.exceptions import BucketNotFoundError
fr... | {
"repo_name": "jleung51/scripts",
"path": "couchbase_cmd/cb_cmd.py",
"copies": "1",
"size": "4119",
"license": "mit",
"hash": -138112778285846480,
"line_mean": 33.041322314,
"line_max": 109,
"alpha_frac": 0.6537994659,
"autogenerated": false,
"ratio": 3.956772334293948,
"config_test": false,
... |
#!/bin/python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Resolves GPIO driver typedef based on given ID.
# Given ID can be either platform-related ID or user a... | {
"repo_name": "forGGe/theCore",
"path": "platform/common/common.py",
"copies": "2",
"size": "2256",
"license": "mpl-2.0",
"hash": -6333923142863577000,
"line_mean": 30.3333333333,
"line_max": 78,
"alpha_frac": 0.6613475177,
"autogenerated": false,
"ratio": 3.4976744186046513,
"config_test": fal... |
#!/bin/python3
# TODO:
# - try making inserted segments required
# - randomise segment names
# - add crc to our segments
import struct
from collections import namedtuple
from img import Img
Chunk = namedtuple("Chunk", ["type", "len", "start", "end"])
class Png(Img):
def __init__(self, fname):
Img... | {
"repo_name": "jon-stewart/imghide",
"path": "png.py",
"copies": "1",
"size": "3239",
"license": "mit",
"hash": -4394215962145819600,
"line_mean": 25.1209677419,
"line_max": 109,
"alpha_frac": 0.5158999691,
"autogenerated": false,
"ratio": 3.8376777251184833,
"config_test": false,
"has_no_key... |
#!/bin/python3
#TP-Link interface
import urllib.request as h
import time
TP_LINK_HOST="172.18.1.1"
USER="admin"
PASS="admin"
timeout=60
_lastlogin=0
#Humand readable states (from TP_LINK)
_trunk_info = ["", " (LAG1)", " (LAG2)", " (LAG3)", " (LAG4)", " (LAG5)", " (LAG6)", " (LAG7)", " (LAG8)"]
_state_info = ["D... | {
"repo_name": "SebastianSchildt/potatonet-power",
"path": "reliablechoice.py",
"copies": "1",
"size": "3296",
"license": "mit",
"hash": 1432307161399711700,
"line_mean": 23.0583941606,
"line_max": 134,
"alpha_frac": 0.6471480583,
"autogenerated": false,
"ratio": 2.710526315789474,
"config_test"... |
#!/bin/python3
s_len = int(input().strip())
s = input().strip()
unique_letters = list(
set(s)
)
def get_alternating_length(
str_value,
first_letter,
second_letter
):
previous_letter = None
counter = 0
for char_value in str_value:
if (
char_value in [first_letter, seco... | {
"repo_name": "avenet/hackerrank",
"path": "algorithms/strings/two_characters.py",
"copies": "1",
"size": "1026",
"license": "mit",
"hash": -6007330321682692000,
"line_mean": 20.829787234,
"line_max": 59,
"alpha_frac": 0.5623781676,
"autogenerated": false,
"ratio": 3.8,
"config_test": false,
... |
""" This script contains functions for the REST client.
Author: Julien Delplanque
"""
import requests
import json
class UnknownUserException(Exception):
pass
class ServerErrorException(Exception):
pass
def make_request(ip: str, port: int, username: str, passwd: str, service: str):
""" Make a request... | {
"repo_name": "juliendelplanque/raspirestmonitor",
"path": "client/raspi_rest_client.py",
"copies": "1",
"size": "2672",
"license": "mit",
"hash": -4982143462162816000,
"line_mean": 31.987654321,
"line_max": 81,
"alpha_frac": 0.6478293413,
"autogenerated": false,
"ratio": 4.091883614088821,
"co... |
""" This script contains functions to access to sensors data on a raspberry pi
running Archlinux. I have no idea if these commands work on other
distributions.
Author: Julien Delplanque
"""
import subprocess
def get_temperature():
""" Return the temperature of the raspberry pi as a float according to i... | {
"repo_name": "juliendelplanque/raspirestmonitor",
"path": "server/sensors.py",
"copies": "1",
"size": "1598",
"license": "mit",
"hash": 4128547899200838700,
"line_mean": 32.2916666667,
"line_max": 107,
"alpha_frac": 0.6627033792,
"autogenerated": false,
"ratio": 3.5829596412556053,
"config_tes... |
""" This script contains functions to access various system's info.
Author: Julien Delplanque
"""
import subprocess
from datetime import timedelta
from datetime import datetime
def get_uptime():
""" Return the uptime of the system as a timedelta object.
"""
proc = subprocess.Popen(["cat /proc/uptime"]... | {
"repo_name": "juliendelplanque/raspirestmonitor",
"path": "server/systeminfo.py",
"copies": "1",
"size": "2752",
"license": "mit",
"hash": 6963064592289323000,
"line_mean": 34.7402597403,
"line_max": 73,
"alpha_frac": 0.597747093,
"autogenerated": false,
"ratio": 3.6354029062087188,
"config_te... |
""" This script contains functions to check wich packages are updatable on the
system.
Author: Julien Delplanque
"""
import subprocess
class PackageManagerDoesNotExists(Exception):
""" Exception launched if the package manager doesn't exists.
"""
pass
def pacman_packages_to_update():
""" Retur... | {
"repo_name": "juliendelplanque/raspirestmonitor",
"path": "server/pkgmanagers.py",
"copies": "1",
"size": "1196",
"license": "mit",
"hash": -1094836282170559100,
"line_mean": 35.2424242424,
"line_max": 91,
"alpha_frac": 0.6789297659,
"autogenerated": false,
"ratio": 3.4171428571428573,
"config... |
""" This script contains the implementation of the REST api on the
raspberry-pi.
Author: Julien Delplanque
"""
import subprocess
from flask import Flask, jsonify, Response
from flask.ext.httpauth import HTTPBasicAuth
import sensors
import pkgmanagers
import systeminfo
from passwordmanagement import PasswordMan... | {
"repo_name": "juliendelplanque/raspirestmonitor",
"path": "server/raspi_rest_server.py",
"copies": "1",
"size": "2439",
"license": "mit",
"hash": 1648283853477043500,
"line_mean": 33.3521126761,
"line_max": 84,
"alpha_frac": 0.6469864699,
"autogenerated": false,
"ratio": 3.9024,
"config_test":... |
""" This script is an exemple of interface for the REST client.
It inform the user of changes using gnome's notifications.
Author: Julien Delplanque
"""
from gi.repository import Notify
import time
from raspi_rest_client import *
GREETING="Dear sir,"
SAY_GOODBYE="Sincerly, your raspberry pi."
def format_mess... | {
"repo_name": "juliendelplanque/raspirestmonitor",
"path": "client/gnome_notifications_interface.py",
"copies": "1",
"size": "1312",
"license": "mit",
"hash": -6722173437636507000,
"line_mean": 30.2380952381,
"line_max": 78,
"alpha_frac": 0.6455792683,
"autogenerated": false,
"ratio": 3.536388140... |
#!/bin/python3
try:
# permet de lancer le fichier mère (distributeur.py)
from data import ingredient
except ImportError:
# permet de lancer ce fichier en stand-alone
import ingredient
class MetaBoisson(type):
def __str__(cls):
return cls.__name__
def __iter__(cls):
return cls... | {
"repo_name": "NestarZ/drinkdispenser",
"path": "drinkdispenser/data/boisson.py",
"copies": "1",
"size": "5626",
"license": "mit",
"hash": -4006481147933176300,
"line_mean": 34.641025641,
"line_max": 79,
"alpha_frac": 0.6327338129,
"autogenerated": false,
"ratio": 3.106145251396648,
"config_tes... |
#!/bin/python3
# workaround from https://github.com/requests/requests/issues/3752
import gevent.monkey
gevent.monkey.patch_ssl()
import requests
import multiprocessing
import time
import grequests
assets = ['USD', 'USDT', 'EUR', 'BTC', 'XRP', 'ETH', 'HKD', 'LTC', 'RUR',
'CNY', 'DASH', 'ZEC', 'ETC', 'BCH']
#... | {
"repo_name": "joequant/bitcoin-price-api",
"path": "scripts/dumpprices.py",
"copies": "1",
"size": "8676",
"license": "mit",
"hash": -5373471683613842000,
"line_mean": 31.6165413534,
"line_max": 102,
"alpha_frac": 0.4568925772,
"autogenerated": false,
"ratio": 3.1722120658135284,
"config_test"... |
#!/bin/python3
class Node:
def __init__(self,data):
self.data = data
self.next = None
class Solution:
def insert(self,head,data):
p = Node(data)
if head==None:
head=p
elif head.next==None:
head.next=p
... | {
"repo_name": "kyle8998/Practice-Coding-Questions",
"path": "hackerrank/30-days-of-code/day-24.py",
"copies": "1",
"size": "1470",
"license": "unlicense",
"hash": 2521765798450279400,
"line_mean": 25.7735849057,
"line_max": 67,
"alpha_frac": 0.4979591837,
"autogenerated": false,
"ratio": 4.362017... |
#!/bin/python3
import sys
class Node:
def __init__(self,data):
self.right=self.left=None
self.data = data
class Solution:
def insert(self,root,data):
if root==None:
return Node(data)
else:
if data<=root.data:
cur=self.insert... | {
"repo_name": "kyle8998/Practice-Coding-Questions",
"path": "hackerrank/30-days-of-code/day-23.py",
"copies": "1",
"size": "1209",
"license": "unlicense",
"hash": 6775429288287426000,
"line_mean": 24.8666666667,
"line_max": 59,
"alpha_frac": 0.5028949545,
"autogenerated": false,
"ratio": 3.990099... |
#!/bin/python3
import sys
class Person:
def __init__(self, firstName, lastName, idNumber):
self.firstName = firstName
self.lastName = lastName
self.idNumber = idNumber
def printPerson(self):
print("Name:", self.lastName + ",", self.firstName)
print("ID:", self.idNumber)
class Student(Perso... | {
"repo_name": "kyle8998/Practice-Coding-Questions",
"path": "hackerrank/30-days-of-code/day-12.py",
"copies": "1",
"size": "1640",
"license": "unlicense",
"hash": -1899316796045927200,
"line_mean": 28.4074074074,
"line_max": 72,
"alpha_frac": 0.5859756098,
"autogenerated": false,
"ratio": 3.54978... |
#!/bin/python3
import sys
class Solution:
# Write your code here
def __init__(self):
self.stack = []
self.queue = []
def pushCharacter(self, char):
self.stack.append(char)
def enqueueCharacter(self, char):
self.queue.append(char)
... | {
"repo_name": "kyle8998/Practice-Coding-Questions",
"path": "hackerrank/30-days-of-code/day-18.py",
"copies": "1",
"size": "1192",
"license": "unlicense",
"hash": -8216085529376060000,
"line_mean": 21.4117647059,
"line_max": 54,
"alpha_frac": 0.5998322148,
"autogenerated": false,
"ratio": 3.60120... |
#!/bin/python3
"""
https://www.hackerrank.com/challenges/bear-and-workbook?h_r=next-challenge&h_v=zen
Lisa just got a new math workbook. A workbook contains exercise problems, grouped into chapters.
* There are n chapters in Lisa's workbook, numbered from 1 to n.
* The i-th chapter has ti problems, numbered ... | {
"repo_name": "caoxudong/code_practice",
"path": "hackerrank/016_lisas_workbook.py",
"copies": "1",
"size": "3639",
"license": "mit",
"hash": -6937808335515648000,
"line_mean": 37.967032967,
"line_max": 205,
"alpha_frac": 0.5111355513,
"autogenerated": false,
"ratio": 3.7150153217568946,
"confi... |
#!/bin/python3
"""
https://www.hackerrank.com/challenges/chocolate-feast?h_r=next-challenge&h_v=zen
Little Bob loves chocolate, and he goes to a store with $N in his pocket. The price of each chocolate is $C. The store offers a discount: for every M wrappers he gives to the store, he gets one chocolate for free.... | {
"repo_name": "caoxudong/code_practice",
"path": "hackerrank/015_chocolate_feast.py",
"copies": "1",
"size": "1815",
"license": "mit",
"hash": 4280699287914086400,
"line_mean": 26.359375,
"line_max": 270,
"alpha_frac": 0.6545454545,
"autogenerated": false,
"ratio": 3.2880434782608696,
"config_t... |
#!/bin/python3
"""
https://www.hackerrank.com/challenges/diagonal-difference
Given a square matrix of size N * N, calculate the absolute difference between the sums of its diagonals.
Input Format
The first line contains a single integer, N. The next N lines denote the matrix's rows, with each line containi... | {
"repo_name": "caoxudong/code_practice",
"path": "hackerrank/004_diagonal_difference.py",
"copies": "1",
"size": "1192",
"license": "mit",
"hash": -1402343242890244900,
"line_mean": 16.65625,
"line_max": 164,
"alpha_frac": 0.6384228188,
"autogenerated": false,
"ratio": 3.1786666666666665,
"conf... |
#!/bin/python3
"""
https://www.hackerrank.com/challenges/find-digits?h_r=next-challenge&h_v=zen
Given an integer, N, traverse its digits (d1,d2,...,dn) and determine how many digits evenly divide N(i.e.: count the number of times N divided by each digit di has a remainder of 0). Print the number of evenly divis... | {
"repo_name": "caoxudong/code_practice",
"path": "hackerrank/011_find_digits.py",
"copies": "1",
"size": "1616",
"license": "mit",
"hash": -2074816189538166000,
"line_mean": 24.9666666667,
"line_max": 229,
"alpha_frac": 0.6522277228,
"autogenerated": false,
"ratio": 3.467811158798283,
"config_t... |
#!/bin/python3
"""
https://www.hackerrank.com/challenges/plus-minus?h_r=next-challenge&h_v=zen
Given an array of integers, calculate which fraction of its elements are positive, which fraction of its elements are negative, and which fraction of its elements are zeroes, respectively. Print the decimal value of ea... | {
"repo_name": "caoxudong/code_practice",
"path": "hackerrank/005_plus_minus.py",
"copies": "1",
"size": "1801",
"license": "mit",
"hash": 5963965866792173000,
"line_mean": 26.619047619,
"line_max": 244,
"alpha_frac": 0.6846196557,
"autogenerated": false,
"ratio": 3.49031007751938,
"config_test"... |
#!/bin/python3
"""
https://www.hackerrank.com/challenges/service-lane?h_r=next-challenge&h_v=zen
Calvin is driving his favorite vehicle on the 101 freeway. He notices that the check engine light of his vehicle is on, and he wants to service it immediately to avoid any risks. Luckily, a service lane runs parallel... | {
"repo_name": "caoxudong/code_practice",
"path": "hackerrank/013_service_lane.py",
"copies": "1",
"size": "4372",
"license": "mit",
"hash": -3266446286292433400,
"line_mean": 36.6902654867,
"line_max": 352,
"alpha_frac": 0.6006404392,
"autogenerated": false,
"ratio": 3.5372168284789645,
"config... |
#!/bin/python3
"""
https://www.hackerrank.com/challenges/sherlock-and-the-beast?h_r=next-challenge&h_v=zen
Sherlock Holmes suspects his archenemy, Professor Moriarty, is once again plotting something diabolical. Sherlock's companion, Dr. Watson, suggests Moriarty may be responsible for MI6's recent issues with t... | {
"repo_name": "caoxudong/code_practice",
"path": "hackerrank/009_sherlock_and_the_beast.py",
"copies": "1",
"size": "2635",
"license": "mit",
"hash": 1090530540464136400,
"line_mean": 29,
"line_max": 278,
"alpha_frac": 0.6832510444,
"autogenerated": false,
"ratio": 3.450851900393185,
"config_te... |
#!/bin/python3
"""
https://www.hackerrank.com/challenges/utopian-tree?h_r=next-challenge&h_v=zen
The Utopian Tree goes through 2 cycles of growth every year. Each spring, it doubles in height. Each summer, its height increases by 1 meter.
Laura plants a Utopian Tree sapling with a height of 1 meter at the ons... | {
"repo_name": "caoxudong/code_practice",
"path": "hackerrank/010_utopian_tree.py",
"copies": "1",
"size": "1575",
"license": "mit",
"hash": 1954501485494359300,
"line_mean": 22.640625,
"line_max": 255,
"alpha_frac": 0.6463492063,
"autogenerated": false,
"ratio": 3.3298097251585626,
"config_test... |
#!/bin/python3
t = int(input().strip())
for a0 in range(t):
n, k = input().strip().split(' ')
n, k = [int(n), int(k)]
max = 0
for a in range(1, n):
for b in range(a + 1, n + 1):
bw = a & b
if bw > max and bw < k:
max = bw
print(max)
... | {
"repo_name": "kalpak92/HackerRank-30-Days-of-Code",
"path": "Day 29/solution.py",
"copies": "1",
"size": "1288",
"license": "unlicense",
"hash": 1600131621736104000,
"line_mean": 28.6666666667,
"line_max": 226,
"alpha_frac": 0.4712732919,
"autogenerated": false,
"ratio": 3.0377358490566038,
"c... |
"""
Usage:
python3 var_report.py (in the directory of interest)
Input file(s):
H{H,O}_*.annotated.txt
Output file(s):
AllAnnotatedVariants.txt
Tools:
Process line-by-line, file-by-file with Python
"""
import glob
from collections import OrderedDict
def parseReads(frmt, reads)... | {
"repo_name": "tri-CSI/Bioinfo",
"path": "variant_calling_anno/combine_variant_files/var_report.py",
"copies": "1",
"size": "3575",
"license": "cc0-1.0",
"hash": -6423961364838087000,
"line_mean": 25.2900763359,
"line_max": 86,
"alpha_frac": 0.5183216783,
"autogenerated": false,
"ratio": 3.307123... |
"""
Usage:
python3 var_report.py (in the directory of interest)
Input file(s):
GC*_asn_maf.txt
Output file(s):
AllAnnotatedVariants.txt
Tools:
Process line-by-line, file-by-file with Python
"""
import glob
from collections import OrderedDict
def parseReads(frmt, reads):
... | {
"repo_name": "tri-CSI/Bioinfo",
"path": "projects/khk_snp/allVariants_khk_report.py",
"copies": "1",
"size": "3900",
"license": "cc0-1.0",
"hash": 7438728813431852000,
"line_mean": 26.8888888889,
"line_max": 107,
"alpha_frac": 0.5192307692,
"autogenerated": false,
"ratio": 3.24729392173189,
"c... |
#!/bin/python.elf
"""Wiki main program. Imported and run by cgi3.py."""
import os, re, cgi, sys, tempfile
escape = cgi.escape
def main():
form = cgi.FieldStorage()
print "Content-type: text/html"
print
cmd = form.getvalue("cmd", "view")
page = form.getvalue("page", "FrontPage")
wiki = WikiPag... | {
"repo_name": "easion/os_sdk",
"path": "iso/www/cgi_bin/wiki.py",
"copies": "1",
"size": "4055",
"license": "apache-2.0",
"hash": 3960709608967771000,
"line_mean": 31.7016129032,
"line_max": 76,
"alpha_frac": 0.5102342787,
"autogenerated": false,
"ratio": 3.730450781968721,
"config_test": false... |
#! bin/python_interpreter
# BEFORE SCRIPT RUN YOU SHOULD STOP CHRONOGRAPH:
# bin/circusctl stop chronograph
# HOW TO USE:
# run the command:
# ./test.py simple planning && ./test.py simple run
# or
# ./test.py multilot planning && ./test.py multilot run
# or
# ./test.py esco planning && ./test.py esco run
# or
# ./te... | {
"repo_name": "openprocurement/openprocurement.auction.buildout",
"path": "test.py",
"copies": "1",
"size": "4162",
"license": "apache-2.0",
"hash": -5342033633489087000,
"line_mean": 37.8971962617,
"line_max": 153,
"alpha_frac": 0.642239308,
"autogenerated": false,
"ratio": 3.3005551149881045,
... |
import sys
import os
import re
# -----------------------------------------------------------------------------
if sys.argv[0] != 'bin/replace_html.py' :
msg = 'bin/replace_html.py: must be executed from its parent directory'
sys.exit(msg)
#
usage = '''\nusage: replace_html.py old_file new_file
where old_file is the ... | {
"repo_name": "tkelman/CppAD-oldmirror",
"path": "bin/replace_html.py",
"copies": "1",
"size": "4287",
"license": "epl-1.0",
"hash": 4929677421426178000,
"line_mean": 36.9380530973,
"line_max": 79,
"alpha_frac": 0.5353393982,
"autogenerated": false,
"ratio": 3.3623529411764705,
"config_test": f... |
from __future__ import print_function
# -----------------------------------------------------------------------------
# list of svn commands to execute in the svn directory before make changes
# indicated by git directory; some example commands are included below
svn_commands = [
# 'svn mkdir cppad/utility',
# 'svn ... | {
"repo_name": "wegamekinglc/CppAD",
"path": "bin/push_git2svn.py",
"copies": "1",
"size": "11193",
"license": "epl-1.0",
"hash": -5643286258929388000,
"line_mean": 34.309148265,
"line_max": 79,
"alpha_frac": 0.5636558563,
"autogenerated": false,
"ratio": 3.2585152838427947,
"config_test": false... |
from __future__ import print_function
# -----------------------------------------------------------------------------
# imports
import sys
import os
import re
import subprocess
import pdb
# -----------------------------------------------------------------------------
# command line arguments
usage = '\tbin/push_git2svn... | {
"repo_name": "kaskr/CppAD",
"path": "bin/push_git2svn.py",
"copies": "1",
"size": "10379",
"license": "epl-1.0",
"hash": -8525584521166574000,
"line_mean": 34.3027210884,
"line_max": 79,
"alpha_frac": 0.5694190192,
"autogenerated": false,
"ratio": 3.2434375,
"config_test": false,
"has_no_key... |
#!/bin/python
"""Angya main application.
This module contains the URL routing logic, and defines the URL handlers.
"""
import flask
#local URL handlers
import map #handles the /map url
import widgets.infocard
import widgets.login
import widgets.nav
import widgets.search
import widgets.socialshare
import widgets.timel... | {
"repo_name": "susi/angya",
"path": "angya.py",
"copies": "1",
"size": "2110",
"license": "apache-2.0",
"hash": -8816748738329503000,
"line_mean": 24.7317073171,
"line_max": 73,
"alpha_frac": 0.6924170616,
"autogenerated": false,
"ratio": 3.487603305785124,
"config_test": false,
"has_no_keywo... |
#/bin/python
# A program for scraping pages and reading the web forms
import mechanize
import logging
import time
from optparse import OptionParser
from urllib2 import HTTPError
start = time.time()
def get_forms(target):
br = mechanize.Browser()
br.set_handle_equiv(False)
br.set_handle_redirect(True)
br.set_... | {
"repo_name": "thedarkcoder/SPSE",
"path": "mechanize_webform_inspect.py",
"copies": "2",
"size": "1953",
"license": "mit",
"hash": 3467010024584449000,
"line_mean": 28.1492537313,
"line_max": 80,
"alpha_frac": 0.6231438812,
"autogenerated": false,
"ratio": 3.6849056603773587,
"config_test": fa... |
#!/bin/python
archi=open("datos.txt","w")
archi.close()
archi=open("datos.txt",'a')
lista=["salina","tehuantepec","juchitan","oaxaca","ixtepec","ixtaltepec","tonala","pijijiapan","huixtla","tapachula","tuxtla","villahermosa","comitan","sancristo","ocosingo","palenque","huatulco","ptoesco","puebla","cardenaz","cdcarmen"... | {
"repo_name": "subzeroDevelopment/InteligenciaArtificial",
"path": "citi.py",
"copies": "1",
"size": "1030",
"license": "mit",
"hash": -814833963309736800,
"line_mean": 25.4102564103,
"line_max": 418,
"alpha_frac": 0.654368932,
"autogenerated": false,
"ratio": 2.1548117154811717,
"config_test":... |
#!/bin/python
# A script for export framework data to unpacked mod file structure
from os import walk, makedirs, sep
from os.path import join, relpath, dirname, exists, normpath, basename
from json import load, dump
from shutil import copy
from json_tools import field_by_path
from re import compile as regex
from codec... | {
"repo_name": "GuardOscar/Starbound_RU",
"path": "tools/export_mod.py",
"copies": "10",
"size": "5207",
"license": "apache-2.0",
"hash": -4264723267227277300,
"line_mean": 31.3416149068,
"line_max": 87,
"alpha_frac": 0.6427885539,
"autogenerated": false,
"ratio": 3.5762362637362637,
"config_tes... |
# Imports
import numpy as np
import decimal
# Linear Regression class
class LinearRegression(object):
""" LinearRegression model """
# Properties
X = [] # Dataset
Y = [] # Results dataset
T = [] # Theta parameters
a = 0 # Learning rate alpha
m = 0 # Size of X
n = 0 # Number of ... | {
"repo_name": "matheus-santos/linear_regression",
"path": "LinearRegression.py",
"copies": "1",
"size": "6367",
"license": "mit",
"hash": 7020313575207740000,
"line_mean": 26.6826086957,
"line_max": 77,
"alpha_frac": 0.5438982252,
"autogenerated": false,
"ratio": 3.976889444097439,
"config_test... |
import numpy as np
print 'Numpy version:', np.version.version
import pandas as pd
import scipy.cluster as spc
import scipy.spatial as sps
import random
import itertools
import sys
import fastcluster
import re
import time
import cPickle
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from copy i... | {
"repo_name": "corcra/bf2",
"path": "src/explore_fns.py",
"copies": "1",
"size": "24827",
"license": "mit",
"hash": 6357007214661212000,
"line_mean": 34.6709770115,
"line_max": 114,
"alpha_frac": 0.5764691666,
"autogenerated": false,
"ratio": 3.542160079897275,
"config_test": false,
"has_no_k... |
"""This is a script which returns the number of GitHub notifications that the
user has."""
import fileinput
import json
import os
import sys
import urllib.request
def get_api_token():
"""Returns the GitHub api token that the user has set at
GH_NOTIFICATION_TOKEN or has passed in from standard input.
Sta... | {
"repo_name": "ExcaliburZero/github-notification-number",
"path": "notifications.py",
"copies": "2",
"size": "3137",
"license": "mit",
"hash": -7649761509061305000,
"line_mean": 31.6770833333,
"line_max": 103,
"alpha_frac": 0.7111890341,
"autogenerated": false,
"ratio": 4.332872928176796,
"conf... |
#!/bin/python
# CallHap Config Creator
# Version 0.1.3
# by Brendan Kohrn
from argparse import ArgumentParser
import time
parser = ArgumentParser()
parser.add_argument("--input", action = 'store', dest='readgroupTemplate', required=True, help="a csv file containing the input files and all information for readgroup c... | {
"repo_name": "cruzan-lab/CallHap",
"path": "CallHap_ConfigCreator.py",
"copies": "1",
"size": "3813",
"license": "mit",
"hash": -2110059377950288400,
"line_mean": 44.4047619048,
"line_max": 235,
"alpha_frac": 0.679779701,
"autogenerated": false,
"ratio": 2.9444015444015443,
"config_test": fals... |
#!/bin/python
# Class/functions for (finite) MDP, with policy-solving via value iteration.
import numpy as np
from agents import PolicyFun
def policy_iteration(n_states, actions, rewards, discount):
"""
Perform policy iteration to find the optimal policy for a MDP.
(returns a policy)
"""
# TODO: a... | {
"repo_name": "corcra/pRLy",
"path": "MDP/mdp.py",
"copies": "1",
"size": "3062",
"license": "mit",
"hash": 4291013939549696500,
"line_mean": 38.2564102564,
"line_max": 85,
"alpha_frac": 0.5708687133,
"autogenerated": false,
"ratio": 4.02365308804205,
"config_test": false,
"has_no_keywords": ... |
#!/bin/python
# -*- coding: cp1252 -*-
'''
// Licenca Creative Commons
// Circuitos Integrados e Sistemas Embarcados - Relatorio Final de
// Gustavo Esteves, Joao Ferreira, Kadna Maria e Sergio Mendonca
// esta licenciado com uma Licenca Creative Commons
// Atribuicao-NaoComercial-CompartilhaIgual 4.0 Internacional.
/... | {
"repo_name": "sftom/ee1054",
"path": "sources/EE1054-Atividade07-Questao03-DHT.py",
"copies": "1",
"size": "3436",
"license": "cc0-1.0",
"hash": -105911332491215100,
"line_mean": 37.1888888889,
"line_max": 70,
"alpha_frac": 0.5148428405,
"autogenerated": false,
"ratio": 3.332686711930165,
"con... |
import sys
try:
input = 'E:/Uni/_Hiwi/osm_nepal/data/idp_camps_with_tags_and_timestamp_center.geojson'
input_2 = 'E:/Uni/_Hiwi/osm_nepal/data/idp_3857_s.geojson'
output = 'E:/Uni/_Hiwi/osm_nepal/PyBossa/shelter_dynamics_observer/tasks_shelter_dynamics_observer_new.csv'
except:
print "ERROR: Not enough program ... | {
"repo_name": "Hagellach37/IDP-Camp-Sites-Validation",
"path": "create_tasks_geojson_new.py",
"copies": "1",
"size": "1768",
"license": "mit",
"hash": -8679496689287944000,
"line_mean": 25.803030303,
"line_max": 152,
"alpha_frac": 0.6391402715,
"autogenerated": false,
"ratio": 2.5660377358490565,... |
import sys
try:
input = 'E:/Uni/_Hiwi/osm_nepal/data/idp_camps_with_tags_and_timestamp_center.geojson'
output = 'E:/Uni/_Hiwi/osm_nepal/PyBossa/shelter_dynamics_observer/tasks_shelter_dynamics_observer_geojson.csv'
except:
print "ERROR: Not enough program arguments given."
print "Require %s inputCSV outputC... | {
"repo_name": "Hagellach37/IDP-Camp-Sites-Validation",
"path": "create_tasks_geojson.py",
"copies": "1",
"size": "1190",
"license": "mit",
"hash": -3204064491226330000,
"line_mean": 24.8913043478,
"line_max": 113,
"alpha_frac": 0.6445378151,
"autogenerated": false,
"ratio": 2.735632183908046,
"... |
'''迁移前请先清空新数据的表数据
>SET FOREIGN_KEY_CHECKS=0;
>TRUNCATE hosts;
>TRUNCATE users;
>TRUNCATE pros;
>TRUNCATE dbs;
>TRUNCATE user_pro;
>TRUNCATE user_db;
'''
import MySQLdb
def old_db(sql):
conn = MySQLdb.connect(host='10.139.49.166',port=3306,user='opsmanager',passwd='opsmanager... | {
"repo_name": "linuxyan/opsmanage",
"path": "scripts/migration.py",
"copies": "1",
"size": "1586",
"license": "apache-2.0",
"hash": 2167855970534997200,
"line_mean": 28.3653846154,
"line_max": 130,
"alpha_frac": 0.6612057667,
"autogenerated": false,
"ratio": 2.501639344262295,
"config_test": fa... |
#!/bin/python
# -*- coding:utf-8 -*-
#copied from http://blog.csdn.net/linvo/article/details/9919611
"""
增量梯度下降
y=1+0.5x
"""
import sys
# 训练数据集
# 自变量x(x0,x1)
x = [(1,1.15),(1,1.9),(1,3.06),(1,4.66),(1,6.84),(1,7.95)]
# 假设函数 h(x) = theta0*x[0] + theta1*x[1]
# y为理想theta值下的真实函数值
y = [1.37,2.4,3.02,3.06,4.22,5.42]
#... | {
"repo_name": "kelly6/liner_regection_test",
"path": "csdn_demo.py",
"copies": "1",
"size": "1581",
"license": "mit",
"hash": -3232255953681213400,
"line_mean": 19.8983050847,
"line_max": 73,
"alpha_frac": 0.5798864558,
"autogenerated": false,
"ratio": 1.726890756302521,
"config_test": false,
... |
"""This is a utility module which helps finding and compiling uic files using
the system python.
"""
import os
import glob
from anima import utils, logger
# PyQt4
try:
from PyQt4 import uic
pyqt4_compiler = uic
except ImportError:
pyqt4_compiler = None
# PySide
try:
from pysideuic import compileUi
... | {
"repo_name": "sergeneren/anima",
"path": "anima/ui/uiCompiler.py",
"copies": "1",
"size": "6874",
"license": "bsd-2-clause",
"hash": 841508057528389900,
"line_mean": 26.1699604743,
"line_max": 79,
"alpha_frac": 0.5660459703,
"autogenerated": false,
"ratio": 3.7257452574525747,
"config_test": f... |
#!/bin/python
# -*- coding: utf8 -*-
from ConfigWidget import *
from LatticeWidget import *
from EvolveWidget import *
from ReprWidget import *
from JobsWidget import *
class ConfGen(QMainWindow):
def __init__(self):
super().__init__()
self.setCentralWidget(QWidget())
self.Init()
self.TabOrdering = ... | {
"repo_name": "Milias/ModellingSimulation",
"path": "Week4/python/config.py",
"copies": "1",
"size": "1601",
"license": "mit",
"hash": 5473664461477749000,
"line_mean": 28.1090909091,
"line_max": 166,
"alpha_frac": 0.6695815116,
"autogenerated": false,
"ratio": 3.3493723849372383,
"config_test"... |
#!/bin/python
# -*- coding: utf-8 -*-
from __future__ import division
import aiml
import subprocess
from itertools import izip
# Load Kernel from AIML
k1 = aiml.Kernel()
k2 = aiml.Kernel()
file1 = "aiml/bot1.aiml"
k1.learn(file1)
file2 = "aiml/bot2.aiml"
k2.learn(file2)
with open('input/meteo.txt') as textfile1, op... | {
"repo_name": "laurentfite/AIMLComparator",
"path": "eval.py",
"copies": "1",
"size": "2997",
"license": "mit",
"hash": 4078062195875431400,
"line_mean": 27.8173076923,
"line_max": 83,
"alpha_frac": 0.4884884885,
"autogenerated": false,
"ratio": 3.1121495327102804,
"config_test": false,
"has_... |
#!bin/python
# -*- coding: utf-8 -*-
from __future__ import division
import argparse
import os
import sys
from scipy.odr.odrpack import Model, RealData, ODR
from numpy import array, exp, log, gradient
from pylab import errorbar, linspace, title, xlabel, ylabel, show, savefig
from scipy import optimize
def read_cd_data... | {
"repo_name": "naderm/wet-lab-tools",
"path": "cd_temp_melt.py",
"copies": "1",
"size": "4970",
"license": "bsd-2-clause",
"hash": 612247045814281600,
"line_mean": 34.2482269504,
"line_max": 80,
"alpha_frac": 0.5344064386,
"autogenerated": false,
"ratio": 3.0946450809464507,
"config_test": fals... |
#!/bin/python
# -*- coding: utf-8 -*-
# from http://zetcode.com/db/postgresqlpythontutorial/
import psycopg2
import sys
import os
con = None
try:
con = psycopg2.connect(database='myDb', user='myUser')
cur = con.cursor()
cur.execute('SELECT year_begin, month_id_begin from tambora_temperature_mont... | {
"repo_name": "ElenorFrisbee/MSC",
"path": "regmodR/startup_scripts/ppmake.py",
"copies": "1",
"size": "1366",
"license": "mit",
"hash": -4630492388648274000,
"line_mean": 29.3777777778,
"line_max": 164,
"alpha_frac": 0.527818448,
"autogenerated": false,
"ratio": 3.062780269058296,
"config_test... |
#!/bin/python
# -*- coding: utf-8 -*-
from numpy import *
import matplotlib.pyplot as plt
import json
import sys
def PlotHistogram(filename, step):
data = json.loads(open(filename, 'r').read())
y = array(data["NormalizedDensity"])
x = array(data["BinDistances"])
y_avg = average(y[step:], axis=0)
rho = avera... | {
"repo_name": "Milias/ModellingSimulation",
"path": "Week5/python/graphs.py",
"copies": "1",
"size": "1123",
"license": "mit",
"hash": 3283211418920543700,
"line_mean": 32.0294117647,
"line_max": 99,
"alpha_frac": 0.6527159394,
"autogenerated": false,
"ratio": 2.994666666666667,
"config_test": ... |
#!/bin/python
# -*- coding: UTF-8 -*-
# ignored, this file store password info
import config_private
import requests
import json
import time
class Mail:
def __init__(self, flog):
self.time_lock = {}
self.flog = flog
def send_timed(self, second_lock, subject, text):
if (subject in self... | {
"repo_name": "jiady/htdb",
"path": "crawler/crawler/mail.py",
"copies": "1",
"size": "1466",
"license": "mit",
"hash": -3948941918987346000,
"line_mean": 30.1063829787,
"line_max": 95,
"alpha_frac": 0.5540355677,
"autogenerated": false,
"ratio": 3.4644549763033177,
"config_test": false,
"has... |
#!/bin/python
# coding:utf-8
import numpy as np
import tensorflow as tf
import time
import datetime
import socket
import os
# Define parameters
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_float('learning_rate', 0.00003, 'Initial learning rate.')
tf.app.flags.DEFINE_integer('steps_to_validate', 100, 'Steps to valida... | {
"repo_name": "xiechengsheng/distribute-ML-demo",
"path": "gradient.py",
"copies": "1",
"size": "4850",
"license": "apache-2.0",
"hash": 2903209035133786600,
"line_mean": 30.8289473684,
"line_max": 113,
"alpha_frac": 0.5981810666,
"autogenerated": false,
"ratio": 3.231796927187709,
"config_test... |
#!/bin/python
# -*- coding: utf-8 -*-
import os
from bs4 import BeautifulSoup
import html2text
MIME_TO_EXTESION_MAPPING = {
'image/png': '.png',
'image/jpg': '.jpg',
'image/jpeg': '.jpg',
'image/gif': '.gif'
}
REPLACEMENTS = [
(""", "\""),
("&apos;", "'"),
("'", "'"),
("&a... | {
"repo_name": "CarlLee/ENML_PY",
"path": "ENML_PY/__init__.py",
"copies": "1",
"size": "4847",
"license": "mit",
"hash": -4696313347337978000,
"line_mean": 31.3133333333,
"line_max": 99,
"alpha_frac": 0.5877862595,
"autogenerated": false,
"ratio": 3.6225710014947685,
"config_test": false,
"ha... |
#!/bin/python
#-*- coding:utf-8 -*-
import os
import sys
from jinja2 import Template
cdr=os.path.dirname(__file__)
pctf=os.path.join(cdr,'project.cmake')
ptf=open(pctf).read(1024*1024)
pct = Template(ptf.decode('utf8'))
##
uctf=os.path.join(cdr,'unit.cmake')
utf=open(uctf).read(1024*1024)
uct = Template(utf.decode('u... | {
"repo_name": "jj4jj/cmaketools",
"path": "autocmake.py",
"copies": "1",
"size": "1767",
"license": "mit",
"hash": 7860933316215523000,
"line_mean": 30.5535714286,
"line_max": 89,
"alpha_frac": 0.5461233729,
"autogenerated": false,
"ratio": 2.94991652754591,
"config_test": false,
"has_no_keyw... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.