text stringlengths 0 1.05M | meta dict |
|---|---|
#!/bin/env python3
# vim: ts=4 sts=4 sw=4 ft=python expandtab :
import ctypes
import socket
class TcpInfo(ctypes.Structure):
"""TCP_INFO struct in linux 4.2
see /usr/include/linux/tcp.h for details"""
__u8 = ctypes.c_uint8
__u32 = ctypes.c_uint32
__u64 = ctypes.c_uint64
_fields_ = [
... | {
"repo_name": "ModioAB/snippets",
"path": "src/tcp_info.py",
"copies": "1",
"size": "2945",
"license": "apache-2.0",
"hash": -3832841590191228400,
"line_mean": 29.0510204082,
"line_max": 78,
"alpha_frac": 0.5276740238,
"autogenerated": false,
"ratio": 2.9303482587064678,
"config_test": false,
... |
#!/bin/env python3
import autosar
import apx
import time
import threading
@apx.DataListener.register
class MyApxWorker(apx.DataListener):
def __init__(self, client):
self.client = client
self.lock=threading.Lock()
client.set_listener(self) #register on_data method to be called wh... | {
"repo_name": "cogu/py-apx",
"path": "examples/client/stress_test1.py",
"copies": "1",
"size": "2297",
"license": "mit",
"hash": 3513817641515175400,
"line_mean": 33.890625,
"line_max": 93,
"alpha_frac": 0.5829342621,
"autogenerated": false,
"ratio": 3.428358208955224,
"config_test": true,
"h... |
'''
Created on Sep 30, 2016
@author: brunsc
'''
import os
import sys
import time
from ktx.octree.ktx_from_rendered_tiff import RenderedMouseLightOctree
def convert_subtree(
input_root_folder,
output_root_folder,
subtree_tip=[],
subtree_le... | {
"repo_name": "cmbruns/pyktx",
"path": "src/tools/convert_subtree_full.py",
"copies": "1",
"size": "3201",
"license": "mit",
"hash": -7006657842819449000,
"line_mean": 32.0531914894,
"line_max": 87,
"alpha_frac": 0.5648234927,
"autogenerated": false,
"ratio": 3.3765822784810124,
"config_test": ... |
#!/bin/env python3
'''
A little module for creating hierarchical word clusters.
This is based loosely on the following paper.
Peter F. Brown; Peter V. deSouza; Robert L. Mercer; T. J. Watson; Vincent J.
Della Pietra; Jenifer C. Lai. 1992. Class-Based n-gram Models of Natural
Language. Computational Linguist... | {
"repo_name": "mheilman/tan-clustering",
"path": "pmi_cluster.py",
"copies": "1",
"size": "13474",
"license": "bsd-2-clause",
"hash": -8177704984262523000,
"line_mean": 36.4971428571,
"line_max": 89,
"alpha_frac": 0.5746623126,
"autogenerated": false,
"ratio": 3.910040626813697,
"config_test": ... |
#!/bin/env python3
'''
An implementation for creating hierarchical word clusters based on syntactic
context ("Brown clusters"). This is based on the following papers.
* Peter F. Brown; Peter V. deSouza; Robert L. Mercer; T. J. Watson; Vincent J.
Della Pietra; Jenifer C. Lai. 1992. Class-Based n-gram Models... | {
"repo_name": "mheilman/tan-clustering",
"path": "class_lm_cluster.py",
"copies": "1",
"size": "14943",
"license": "bsd-2-clause",
"hash": 1712608516984002800,
"line_mean": 34.5354523227,
"line_max": 96,
"alpha_frac": 0.5393160677,
"autogenerated": false,
"ratio": 3.860242831309739,
"config_tes... |
#! /bin/env python
# [-a"1 2 3"/--aspath="1 2 3"] [-t1/--thread=1] [-q/--quota=2(M/K)] [-h/--help] IPv4/IPv6_addr
# import argparse # new in version 2.7
import getopt,sys, socket, struct, random, time
import IPy, dns.resolver
def dnslookup(querydomain,type='A'):
#only for IP addr to ASN mapping
type=type.upper... | {
"repo_name": "neoyk/pathperf",
"path": "dnsperf.py",
"copies": "1",
"size": "3046",
"license": "apache-2.0",
"hash": 208328063189230240,
"line_mean": 29.46,
"line_max": 117,
"alpha_frac": 0.6257386737,
"autogenerated": false,
"ratio": 3.2164730728616684,
"config_test": false,
"has_no_keyword... |
#!/bin/env python
"""A command line tool for uploding stuff to pomf.se clones"""
import argparse
from .parse_arguments import parse_arguments
from .hostlist import retrieve_online_host_list
from .hostlist import generate_host_string
from .hostlist import retrieve_local_host_list
import gettext
gettext.install("limf", "... | {
"repo_name": "lc-guy/limf",
"path": "limf/cli.py",
"copies": "2",
"size": "3234",
"license": "mit",
"hash": -6530329789334339000,
"line_mean": 50.3333333333,
"line_max": 94,
"alpha_frac": 0.573283859,
"autogenerated": false,
"ratio": 4.289124668435013,
"config_test": false,
"has_no_keywords"... |
#!/bin/env python
# Adapted from FlowPy 4.0 13.05.20013
import sys
import numpy as np
import pandas as pd
from itertools import izip
class FCSParser:
def __init__(self, filename):
self.fileHeaderVer = '' #FCS version
self.Params = '' #Info on parameters
self.logScale... | {
"repo_name": "Xbar/FCSParser",
"path": "fcsparse.py",
"copies": "1",
"size": "6262",
"license": "apache-2.0",
"hash": -7785202087809782000,
"line_mean": 42.7972027972,
"line_max": 136,
"alpha_frac": 0.4757266049,
"autogenerated": false,
"ratio": 4.409859154929578,
"config_test": false,
"has_... |
#!/bin/env python
# analysing10ks.py
# IEOR242 Applications in Data Analytics
# Jan 25 2016
# names...
# Import required libraries
import requests
# import bs4
from bs4 import BeautifulSoup
# Specify the urls to parse
Colgate_Palmolive2012 = 'http://www.sec.gov/Archives/edgar/data/21665/000144530513000275/cl-123120... | {
"repo_name": "IEOR242-16S-Group6/IEOR242",
"path": "src/Week01_analysing10ks.py",
"copies": "1",
"size": "6797",
"license": "bsd-3-clause",
"hash": 4393154953497796000,
"line_mean": 30.1788990826,
"line_max": 117,
"alpha_frac": 0.671766956,
"autogenerated": false,
"ratio": 3.206132075471698,
"... |
#!/bin/env python
"""An example script for controlling the sector 32 ID-C microscope."""
import logging
from scanlib import update_variable_dict
from aps_32id import NanoTXM
# Prepare for logging data to a file, or whatever
log = logging.getLogger(__name__)
# A dictionary with the options that can be used when inv... | {
"repo_name": "tomography/scanscripts",
"path": "docs/source/examples/my_aps32_script.py",
"copies": "1",
"size": "2180",
"license": "bsd-3-clause",
"hash": 4810591478286885000,
"line_mean": 28.8630136986,
"line_max": 90,
"alpha_frac": 0.6532110092,
"autogenerated": false,
"ratio": 3.797909407665... |
#!/bin/env python
#A python 2.X code
"""Read a config.yaml and
1. Download
2. extract
3. copy and create symlinks in the target directories
"""
import urllib2
import yaml
from subprocess import Popen, PIPE
import os
import shutil
def extract(tarball, target_dir):
"""Return a list of extracted files/folders"""
... | {
"repo_name": "sageskr/sf",
"path": "deploy/installer.py",
"copies": "1",
"size": "2131",
"license": "mit",
"hash": -8934224698607059000,
"line_mean": 24.369047619,
"line_max": 110,
"alpha_frac": 0.6147348663,
"autogenerated": false,
"ratio": 3.420545746388443,
"config_test": true,
"has_no_ke... |
#!/bin/env python
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# To use a consistent encoding
from codecs import open
from os import path
# Always prefer setuptools over distutils
from setuptools import find_packages, setup... | {
"repo_name": "bbfrederick/rapidtide",
"path": "setup.py",
"copies": "1",
"size": "7400",
"license": "apache-2.0",
"hash": -8468342090815654000,
"line_mean": 32.9449541284,
"line_max": 94,
"alpha_frac": 0.6618918919,
"autogenerated": false,
"ratio": 3.392939018798716,
"config_test": true,
"ha... |
#!/bin/env python
# AsterMeta2Shapefile.py
#
# Feb 2013, Trent Hare, USGS, thare@usgs.gov
#
# Description: convert a directory of Aster "meta" file into a polygon shapefile
# *.meta files can be downloaded from the Glovis website.
# License: public domain
try:
from osgeo import osr
from osgeo import ogr
exce... | {
"repo_name": "USGS-Astrogeology/GDAL_scripts",
"path": "AsterMeta2Shapefile/AsterMeta2Shapefile.py",
"copies": "2",
"size": "3157",
"license": "unlicense",
"hash": -6896426289123559000,
"line_mean": 31.2142857143,
"line_max": 81,
"alpha_frac": 0.5898004435,
"autogenerated": false,
"ratio": 3.547... |
import os
import sys
from collections import OrderedDict
## slight modification from grep command
info_for_conversion="""
XXXX,vnl_math_isnan,itk::Math::isnan
XXXX,vnl_math_isinf,itk::Math::isinf
XXXX,vnl_math_isfinite,itk::Math::isfinite
XXXX,vnl_math_isnormal,itk::Math::isnormal
XXXX,vnl_math_max,std::max
XXXX,vnl_... | {
"repo_name": "spinicist/ITK",
"path": "Utilities/Maintenance/VNL_ModernizeNaming.py",
"copies": "9",
"size": "3528",
"license": "apache-2.0",
"hash": -388486202322798850,
"line_mean": 33.9306930693,
"line_max": 102,
"alpha_frac": 0.7157029478,
"autogenerated": false,
"ratio": 2.7306501547987616,... |
import os
import sys
from collections import OrderedDict
## slight modification from grep command
info_for_conversion = """
XXXX,vnl_math_isnan,itk::Math::isnan
XXXX,vnl_math_isinf,itk::Math::isinf
XXXX,vnl_math_isfinite,itk::Math::isfinite
XXXX,vnl_math_isnormal,itk::Math::isnormal
XXXX,vnl_math_max,std::max
XXXX,vn... | {
"repo_name": "vfonov/ITK",
"path": "Utilities/Maintenance/VNL_ModernizeNaming.py",
"copies": "7",
"size": "3561",
"license": "apache-2.0",
"hash": -517230008381733570,
"line_mean": 32.9142857143,
"line_max": 88,
"alpha_frac": 0.698399326,
"autogenerated": false,
"ratio": 2.7626066718386344,
"c... |
__author__ = "John Hover"
__copyright__ = "2017 John Hover"
__credits__ = []
__license__ = "GPL"
__version__ = "0.9.0"
__maintainer__ = "John Hover"
__email__ = "jhover@bnl.gov"
__status__ = "Production"
import argparse
import datetime
import logging
import os
import subprocess
import sys
import time
from ConfigParser... | {
"repo_name": "jhover/rubygem-rpmbuild",
"path": "rubygemrpm.py",
"copies": "1",
"size": "14184",
"license": "apache-2.0",
"hash": -1042816413699980000,
"line_mean": 37.0268096515,
"line_max": 113,
"alpha_frac": 0.4796249295,
"autogenerated": false,
"ratio": 4.018130311614731,
"config_test": tr... |
#!/bin/env python
# A very simple python script to generate jboss/wildfly password hashes
# Requires a username, realm and password
#
# In jboss, these three are hashed as follows (from add-user.sh):
# "
# By default the properties realm expects the entries to be in the format: -
# username=HEX( MD5( username ':'... | {
"repo_name": "rawiriblundell/scripts",
"path": "jboss_pwd_hash.py",
"copies": "1",
"size": "1171",
"license": "mit",
"hash": 3719976816140220400,
"line_mean": 30.6486486486,
"line_max": 95,
"alpha_frac": 0.7301451751,
"autogenerated": false,
"ratio": 3.4747774480712166,
"config_test": false,
... |
"""Monitoring Agent plugin for HTTP/API checks.
"""
import json
from numbers import Number
import monasca_agent.collector.checks.services_checks as services_checks
import monasca_agent.collector.checks_d.http_check as http_check
class HTTPMetrics(http_check.HTTPCheck):
def __init__(self, name, init_config, ag... | {
"repo_name": "sapcc/monasca-agent",
"path": "monasca_agent/collector/checks_d/http_metrics.py",
"copies": "1",
"size": "2835",
"license": "bsd-3-clause",
"hash": -1253464334206097000,
"line_mean": 36.3026315789,
"line_max": 113,
"alpha_frac": 0.5266313933,
"autogenerated": false,
"ratio": 4.7969... |
#!/bin/env python
# codeing: utf8
import json
import os
import os.path
import glob2
import logging
from ply import yacc
from lexer import PingLexer
from grammar import *
import traceback
configObj = None
filesSet = None
fileStrCache = ''
def projectName():
return "PingPHP"
def printStack(e):
if not configObj... | {
"repo_name": "zhengkaifu/PingPHP",
"path": "src/helper.py",
"copies": "1",
"size": "3423",
"license": "mit",
"hash": -4664359455116041000,
"line_mean": 19.8719512195,
"line_max": 95,
"alpha_frac": 0.6254747298,
"autogenerated": false,
"ratio": 3.3992055610724927,
"config_test": true,
"has_no... |
#!/bin/env python
# codeing: utf8
from ply import lex
from helper import *
reserved = set([
# namespace
'namespace', 'use', 'as',
# class and interface
'class', 'extends', 'implements',
'public', 'private', 'protected',
'static', 'abstract', 'final',
'interface',
# ctrl flow
'if',... | {
"repo_name": "zhengkaifu/PingPHP",
"path": "src/lexer.py",
"copies": "1",
"size": "6927",
"license": "mit",
"hash": 713826061666662100,
"line_mean": 20.5124223602,
"line_max": 189,
"alpha_frac": 0.4859246427,
"autogenerated": false,
"ratio": 2.946405784772437,
"config_test": false,
"has_no_k... |
#!/bin/env python
# -*- coding: cp1252 -*-
# MergeBOM.py ($Id: MergeBOM.py 501 2007-02-01 00:20:34Z veilleux $)
# MergeBOM: A Bill Of Materials utility.
#
# (C) 2005-2007 Tennessee Carmel-Veilleux
# Entreprises TenTech (<tcv - at - ro.boto.ca>)
#
# Permission is granted to use this program for any purpose, including
# ... | {
"repo_name": "tcarmelveilleux/EAGLE_tentech",
"path": "Python Scripts/MergeBOM/MergeBOM.py",
"copies": "1",
"size": "38476",
"license": "mit",
"hash": -8577308529096196000,
"line_mean": 36.8700787402,
"line_max": 158,
"alpha_frac": 0.5982950411,
"autogenerated": false,
"ratio": 3.937372083503888... |
#!/bin/env python
# -*- coding: cp936 -*-
from numpy import array
from Backtrack.NWBacktrack import NWBacktrack
from ScoringMatrix.NWScormat import NWScormat
from Backtrack.SWBacktrack import SWBacktrack
from ScoringMatrix.SWScormat import SWScormat
import sys, os
#######################################################... | {
"repo_name": "shengwang/seqaligner",
"path": "seqalign.py",
"copies": "1",
"size": "2959",
"license": "mit",
"hash": 6627215090071776000,
"line_mean": 34.2261904762,
"line_max": 90,
"alpha_frac": 0.530922609,
"autogenerated": false,
"ratio": 3.205850487540628,
"config_test": false,
"has_no_k... |
#!/bin/env python
# -*- coding: cp936 -*-
from numpy import array
#####################################################
####
def NWBacktrack(arrow, seq1, seq2):
str1, str2 = '', '' ##¼Ç¼ÿ´Î·ûºÏÌõ¼þµÄ×Ö·û´®
strlist1, strlist2 = [], [] ##¼Ç¼·ûºÏÌõ¼þµÄËùÓÐ×Ö·û´®
i, j = len(seq1), len(seq2)
ok = 1
... | {
"repo_name": "shengwang/seqaligner",
"path": "Backtrack/NWBacktrack.py",
"copies": "1",
"size": "2596",
"license": "mit",
"hash": 1883080836092622800,
"line_mean": 29.9047619048,
"line_max": 78,
"alpha_frac": 0.3501540832,
"autogenerated": false,
"ratio": 2.7412882787750794,
"config_test": fal... |
#!/bin/env python
# -*- coding: cp936 -*-
from numpy import array
#########################################################################
def SWBacktrack(scormat, arrow, seq1, seq2):
str1, str2 = '', '' ##¼Ç¼ÿ´Î·ûºÏÌõ¼þµÄ×Ö·û´®
strlist1, strlist2 = [], [] ##¼Ç¼·ûºÏÌõ¼þµÄËùÓÐ×Ö·û´®
## i, j = len(seq1)... | {
"repo_name": "shengwang/seqaligner",
"path": "Backtrack/SWBacktrack.py",
"copies": "1",
"size": "3428",
"license": "mit",
"hash": 4891912133327611000,
"line_mean": 33.28,
"line_max": 77,
"alpha_frac": 0.3532672112,
"autogenerated": false,
"ratio": 2.6635586635586637,
"config_test": false,
"h... |
#!/bin/env python
# -*- coding: cp936 -*-
from numpy import array
#########################################################################
#### ³õʼ»¯¾Ö²¿ÐòÁбȶԣ¨Local Alignmens£©µÄ¼Æ·Ö¾ØÕó£¨scormat£©, ·¾¶¾ØÕó£¨rountmat£©
#### rountmatÖÐÿ¸öÔªËØ´ú±íµÄ»ØËÝ·½Ïò£º (1: ÏòÉÏ»ØËÝ)£¬(0: Ïò×ó»ØËÝ)£¬(2: ÏòбÉÏ·½»ØËÝ)£¬(210... | {
"repo_name": "shengwang/seqaligner",
"path": "ScoringMatrix/SWScormat.py",
"copies": "1",
"size": "3343",
"license": "mit",
"hash": -7788450361392504000,
"line_mean": 40.2716049383,
"line_max": 108,
"alpha_frac": 0.4666467245,
"autogenerated": false,
"ratio": 2.49663928304705,
"config_test": f... |
#!/bin/env python
# -*- coding: cp936 -*-
from numpy import array
#########################################################################
#### ³õʼ»¯È«¾ÖÐòÁÐ±È¶Ô (Global Alignment) µÄ¼Æ·Ö¾ØÕó(scormat) , ·¾¶¾ØÕó(rountmat)
#### scormatµÚÒ»ÐеÚÒ»ÁÐ
#### rountmatÖÐÿ¸öÔªËØ´ú±íµÄ»ØËÝ·½Ïò£º (1: ÏòÉÏ»ØËÝ)£¬(0: Ïò×ó»ØËÝ)£¬... | {
"repo_name": "shengwang/seqaligner",
"path": "ScoringMatrix/NWScormat.py",
"copies": "1",
"size": "3557",
"license": "mit",
"hash": -8535579445356000000,
"line_mean": 39.8850574713,
"line_max": 108,
"alpha_frac": 0.4824290132,
"autogenerated": false,
"ratio": 2.3432147562582344,
"config_test":... |
#! /bin/env python
# -*- coding: gbk -*-
"""Download xiqu"""
import urllib
import urllib2
import gevent
from gevent import monkey
import re
from urlparse import urlparse
from posixpath import basename
monkey.patch_all()
def worker(reg, url):
"""docstring for worker"""
res = urllib.urlopen(url)
reg3 = ... | {
"repo_name": "reverland/scripts",
"path": "python/xiqu.py",
"copies": "1",
"size": "2091",
"license": "mit",
"hash": -1983335589959889400,
"line_mean": 28.8714285714,
"line_max": 86,
"alpha_frac": 0.5652797704,
"autogenerated": false,
"ratio": 3.3085443037974684,
"config_test": false,
"has_n... |
#!/bin/env python
# -*- coding: latin-1 -*-
import smtplib
import email
import email.MIMEText
import email.MIMEImage
import email.MIMEAudio
import email.MIMEMultipart
import mimetypes
import socket
import getpass
import os
import sys
from time import gmtime, strftime
if os.name == "posix":
import pwd
_MIME_PREA... | {
"repo_name": "mailslurper/mailslurper",
"path": "bin/send-complex-mime.py",
"copies": "1",
"size": "10403",
"license": "mit",
"hash": 6989501396508530000,
"line_mean": 34.2440677966,
"line_max": 153,
"alpha_frac": 0.6162354525,
"autogenerated": false,
"ratio": 4.083660644147683,
"config_test":... |
#!/bin/env python
# coding:utf-8$
import subprocess
from subprocess import check_output, CalledProcessError
from flask import Flask, render_template, request, redirect, flash, url_for, jsonify
app = Flask(__name__)
illegal_chars = " '\"/\:;|&`()$<>*?{}[]"
illegal_chars_t = tuple(illegal_chars)
@app.route('/', ... | {
"repo_name": "shrkw/run-your-command-via-web-ui-py",
"path": "main.py",
"copies": "1",
"size": "1096",
"license": "mit",
"hash": -7320257142698165000,
"line_mean": 25.0952380952,
"line_max": 98,
"alpha_frac": 0.5611313869,
"autogenerated": false,
"ratio": 3.546925566343042,
"config_test": fals... |
#! /bin/env python
# -*- coding: utf-8 -*-
# Beief documentation:
# Pathperf client, estimate path BTC from vantage website to this client
# Written and tested under Fedora11 with Python 2.6
# parameter list:
# [-t1/--thread=1] [-i any/--interface=any] [-b/--bypassCDN] [-c/--crawl] [-q/---quota] [-v/--verbose] [-h/--he... | {
"repo_name": "neoyk/search",
"path": "pathperf_client.py",
"copies": "1",
"size": "14117",
"license": "apache-2.0",
"hash": 9160280125420315000,
"line_mean": 37.1540540541,
"line_max": 163,
"alpha_frac": 0.540058086,
"autogenerated": false,
"ratio": 3.47196261682243,
"config_test": false,
"h... |
#!/bin/env/python
# -*- coding: utf8 -*-
# Combine iCalendar files
# $Id$
# uses http://vobject.skyhouseconsulting.com/
import os
import sys
import traceback
import datetime
import glob
import codecs
from ConfigParser import ConfigParser
#import configparser
from optparse import OptionParser, Option, OptionGroup
# 3... | {
"repo_name": "PedroLopes/pyicalmerge",
"path": "pyicalmerge.py",
"copies": "1",
"size": "3384",
"license": "bsd-3-clause",
"hash": 5650510398262404000,
"line_mean": 28.9380530973,
"line_max": 137,
"alpha_frac": 0.5412355897,
"autogenerated": false,
"ratio": 3.8885057471264366,
"config_test": f... |
#!/bin/env python
# -*- coding:utf-8 -*-
# Comment: in order to make it boot you must user rc.local instead of
# /etc/rc.local of your raspberrry
# -------------------------------
import os
import time
import socket
import fcntl
import struct
import smtplib
from email.mime.text import MIMEText
mail_host = 'smtp.163.c... | {
"repo_name": "wenxueliu/myRaspberryPi",
"path": "script/NotificationIP.py",
"copies": "1",
"size": "1914",
"license": "apache-2.0",
"hash": 5454877575959429000,
"line_mean": 25.9577464789,
"line_max": 106,
"alpha_frac": 0.5454545455,
"autogenerated": false,
"ratio": 3.1688741721854305,
"config... |
#!/bin/env python
# coding: utf-8
# company_10K_get_MDNA.py
# IEOR242 Applications in Data Analytics Group 06
# Feb 14 2016
from urllib import urlopen
import re
import bs4
def get_MDNA(html_file):
webpage = urlopen(html_file).read().decode('utf-8)')
soup = bs4.BeautifulSoup(webpage, "html.parser")
scores... | {
"repo_name": "IEOR242-16S-Group6/IEOR242",
"path": "src/company_10k_get_MDNA.py",
"copies": "1",
"size": "1045",
"license": "bsd-3-clause",
"hash": -8003554378112709000,
"line_mean": 32.7096774194,
"line_max": 94,
"alpha_frac": 0.6555023923,
"autogenerated": false,
"ratio": 3.1381381381381384,
... |
#!/bin/env python
# coding: utf-8
# company_10K_tokenization.py
# IEOR242 Applications in Data Analytics Group 06
# Feb 14 2016
import nltk
from nltk.corpus import stopwords
from nltk import stem
import re
from collections import Counter
# Tokenization and word count function
def word_tokenization(text_file):
ra... | {
"repo_name": "aenon/company_10k_analysis",
"path": "src/company_10K_tokenization.py",
"copies": "1",
"size": "1582",
"license": "bsd-2-clause",
"hash": -6447550357058003000,
"line_mean": 30.64,
"line_max": 79,
"alpha_frac": 0.6485461441,
"autogenerated": false,
"ratio": 3.469298245614035,
"con... |
#!/bin/env python
#-*-coding:utf-8-*-
#converting between time string and timestamp
import argparse
import time
import sys
from datetime import datetime
def str2stamp(timestr, fmt):
if not fmt:
fmt = '%Y%m%d'
return str(int(time.mktime(
datetime.strptime(timestr, fmt).timetuple())))
def stam... | {
"repo_name": "zhoufeng1989/python_utils",
"path": "time_convert.py",
"copies": "1",
"size": "1220",
"license": "mit",
"hash": 7110337821569775000,
"line_mean": 29.5,
"line_max": 77,
"alpha_frac": 0.6221311475,
"autogenerated": false,
"ratio": 3.6417910447761193,
"config_test": false,
"has_no... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distribut... | {
"repo_name": "neoyk/pathperf",
"path": "lossrate.py",
"copies": "1",
"size": "20941",
"license": "apache-2.0",
"hash": 8625678891328742000,
"line_mean": 39.4266409266,
"line_max": 180,
"alpha_frac": 0.5150661382,
"autogenerated": false,
"ratio": 3.6330673143650243,
"config_test": false,
"has... |
#! /bin/env python
# -*- coding: utf-8 -*-
# download webpage using wget
# add tcpdump into it
import os, MySQLdb
import string
import time
pm1=MySQLdb.connect(host='127.0.0.1',user='root',db='mnt')
cur1=pm1.cursor()
name=str(time.time())
filepath='./'+name
success = 0
source = ['website1', 'website2','endpoint']
cmd... | {
"repo_name": "neoyk/search",
"path": "80wget.py",
"copies": "1",
"size": "1990",
"license": "apache-2.0",
"hash": 7124482307817937000,
"line_mean": 28.2647058824,
"line_max": 165,
"alpha_frac": 0.5844221106,
"autogenerated": false,
"ratio": 2.335680751173709,
"config_test": false,
"has_no_ke... |
#! /bin/env python
# -*- coding: utf-8 -*-
# download webpage using wget
# add tcpdump into it
import os, MySQLdb, subprocess, shlex
import string, re, time
pm1=MySQLdb.connect(host='127.0.0.1',user='root',db='mnt')
cur1=pm1.cursor()
pattern = re.compile(r"^Transfer rate:\s+(.*)\s\[(.*)\]\sreceived")
source = ['websi... | {
"repo_name": "neoyk/search",
"path": "80ab.py",
"copies": "1",
"size": "1294",
"license": "apache-2.0",
"hash": 8273045752190712000,
"line_mean": 33.0526315789,
"line_max": 103,
"alpha_frac": 0.6692426584,
"autogenerated": false,
"ratio": 2.6958333333333333,
"config_test": false,
"has_no_key... |
#!/bin/env python
#-*- coding: utf-8 -*-
# file generateIdsList.py
import urllib
import os
import sys
import json
import argparse
import gzip
import time
import urllib
import time
from threading import Thread
import multiprocessing
import random
import re
import datetime
#from src.binary_search import *
__author__ ... | {
"repo_name": "MichalCab/freebase",
"path": "src/generate_help_files.py",
"copies": "1",
"size": "11865",
"license": "apache-2.0",
"hash": 7950463747580597000,
"line_mean": 46.0833333333,
"line_max": 150,
"alpha_frac": 0.6308470291,
"autogenerated": false,
"ratio": 3.1019607843137256,
"config_t... |
#!/bin/env python
# coding=utf8
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5 as Cipher_pkcs1_v1_5
import base64
import requests
import json
import urllib
import time
import random
import datetime
import hashlib
# 获得响应头信息中的Content-Type域
def urlOpenGetHeaders(url):
req = urllib.request.Reque... | {
"repo_name": "kingdz2008/test",
"path": "test/downloadAckunMusic.py",
"copies": "1",
"size": "6077",
"license": "mit",
"hash": -3432212792785237500,
"line_mean": 31.0494505495,
"line_max": 278,
"alpha_frac": 0.588547917,
"autogenerated": false,
"ratio": 2.929683576092416,
"config_test": true,
... |
#!/bin/env python
#coding:utf-8
from dbutils import MYSQLConnection
class Users(object):
def __init__(self,id,username,password,age):
self.id=id
self.username=username
self.password=password
self.age=age
@classmethod
def validate_login(cls,username,password):
_colum... | {
"repo_name": "51reboot/actual_09_homework",
"path": "11/zhouyang/cmdb/user/users_class.py",
"copies": "1",
"size": "4407",
"license": "mit",
"hash": -7359412842600941000,
"line_mean": 31.3046875,
"line_max": 83,
"alpha_frac": 0.5854897219,
"autogenerated": false,
"ratio": 3.1734458940905603,
"... |
#! /bin/env python
# -*- coding: utf-8 -*-
from flask import Flask
from flask_jsonrpc import JSONRPC
from RPi import GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
pin_board_numbers = [7, 11, 12, 13, 15, 16, 18, 22, 29, 31, 32, 33, 35, 36, 37, 38, 40]
for bn in pin_board_numbers:
GPIO.setup(bn, GPIO.OUT)
ap... | {
"repo_name": "brunini/raspson",
"path": "raspsond.py",
"copies": "1",
"size": "1574",
"license": "bsd-3-clause",
"hash": -3796940005647812000,
"line_mean": 27.6181818182,
"line_max": 94,
"alpha_frac": 0.6423125794,
"autogenerated": false,
"ratio": 2.9923954372623576,
"config_test": false,
"h... |
#!/bin/env/python
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
import cStringIO
import random
import string
from fabric.api import env, hide, settings, show
from ..openvms import run, put
__all__ = ('run_pml_commands',
'run_pml_file',
)
def run_pml_commands(cmd_list):
"... | {
"repo_name": "fernandezcuesta/fabric-vms",
"path": "fabric_vms/pml/pml.py",
"copies": "2",
"size": "2537",
"license": "apache-2.0",
"hash": -9083098170099064000,
"line_mean": 33.7534246575,
"line_max": 77,
"alpha_frac": 0.6050453291,
"autogenerated": false,
"ratio": 3.4237516869095814,
"config... |
#!/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, print_function, absolute_import, unicode_literals)
##################################################
SHEET_NAME = "H28.10.10現在の団体"
TSV_PREF = "prefs.tsv"
TSV_CITIES = "cities.tsv"
##################################################
import ... | {
"repo_name": "hykw/japan_municipality_key",
"path": "priv/build_source.py",
"copies": "1",
"size": "1952",
"license": "mit",
"hash": -6460980754766857000,
"line_mean": 19.6595744681,
"line_max": 84,
"alpha_frac": 0.5272914521,
"autogenerated": false,
"ratio": 3.0486656200941917,
"config_test":... |
#!/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
try:
from urllib.parse import urlparse, urlsplit
from urllib.request import urlopen
except ImportError:
from urlparse import urlparse, urlsplit
from urllib2 import urlopen
import pkgutil
import base64
import json
import lo... | {
"repo_name": "gastrodia/gfwlist2pac",
"path": "gfwlist2pac/main.py",
"copies": "16",
"size": "6925",
"license": "mit",
"hash": -6993021614623250000,
"line_mean": 31.8199052133,
"line_max": 79,
"alpha_frac": 0.5712635379,
"autogenerated": false,
"ratio": 3.8992117117117115,
"config_test": false... |
#! /bin/env python
# -*- coding: utf-8 -*-
import datetime
import os
from solr import Solr
from harvester.post_processing.couchdb_runner import CouchDBCollectionFilter
from harvester.couchdb_init import get_couchdb
from harvester.solr_updater import map_couch_to_solr_doc, push_doc_to_solr
from harvester.solr_updater im... | {
"repo_name": "ucldc/harvester",
"path": "scripts/sync_couch_collection_to_solr.py",
"copies": "3",
"size": "3150",
"license": "bsd-3-clause",
"hash": -7657814338132073000,
"line_mean": 43.3521126761,
"line_max": 77,
"alpha_frac": 0.7278501111,
"autogenerated": false,
"ratio": 3.976010101010101,
... |
#!/bin/env python
# -*- coding: utf-8 -*-\
import MySQLdb
import config,time
import threading
import logging
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
class MySql(object):
def __init__(self,db_name,logger_name=""):
self.db_name = db_name
self.logger_name = logger_name
self.... | {
"repo_name": "tanyjan/km",
"path": "doc/crawler/src/mysql/__init__.py",
"copies": "1",
"size": "5662",
"license": "apache-2.0",
"hash": 4343623479436408000,
"line_mean": 30.808988764,
"line_max": 119,
"alpha_frac": 0.5153655952,
"autogenerated": false,
"ratio": 3.4629969418960242,
"config_test... |
#!/bin/env python
#coding:utf-8
import MySQLdb
import uconf
class MYSQLConnection(object):
def __init__(self,host,username,passwd,db,port=3306,charset='utf8'):
self.__host=host
self.__username=username
self.__port=port
self.__password=passwd
self.__db=db
self.__char=... | {
"repo_name": "51reboot/actual_09_homework",
"path": "11/zhouyang/cmdb/user/dbutils.py",
"copies": "1",
"size": "2060",
"license": "mit",
"hash": 4191335987547427300,
"line_mean": 28.5217391304,
"line_max": 135,
"alpha_frac": 0.5486247544,
"autogenerated": false,
"ratio": 3.6422182468694095,
"c... |
#/bin/env python
#coding:utf-8
import MySQLdb
import uconf
'''
'''
def db_act(sql,args=(),fetch=True,batch=False):
'''数据库操作。
fetch决定是返回select结果还是执行增,删,改操作的bool结果;
batch表示批处理,对args进行遍历for循环执行'''
rt_list=[]
db_conn=None
db_cursor=None
db_cnt=0
try:
db_conn=MySQLdb.connect(host=ucon... | {
"repo_name": "51reboot/actual_09_homework",
"path": "11/zhouyang/cmdb/user/db_act.py",
"copies": "1",
"size": "1028",
"license": "mit",
"hash": -5361279006460953000,
"line_mean": 25.2222222222,
"line_max": 133,
"alpha_frac": 0.5762711864,
"autogenerated": false,
"ratio": 2.8263473053892216,
"c... |
#/bin/env python
#coding:utf-8
import MySQLdb
import uconf
'''
添加的有问题吧?
数据库中要求为int类型的添加有问题 因为args里面的数据都是str 这个问题咋解决
在哪运行的?
'''
def db_act(sql,args=(),fetch=True,batch=False):
'''数据库操作。
fetch决定是返回select结果还是执行增,删,改操作的bool结果;
batch表示批处理,对args进行遍历for循环执行'''
rt_list=[]
db_conn=None
db_cursor=None
... | {
"repo_name": "51reboot/actual_09_homework",
"path": "09/zhouyang/09/cmdb/user/db_act.py",
"copies": "1",
"size": "1180",
"license": "mit",
"hash": 3085991577938530300,
"line_mean": 24.15,
"line_max": 133,
"alpha_frac": 0.5934393638,
"autogenerated": false,
"ratio": 2.441747572815534,
"config_t... |
#! /bin/env python
# -*- coding: utf-8 -*-
import os,math,time,sys,warnings
import MySQLdb
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import scipy,pylab,fastcluster
from scipy.cluster.hierarchy import dendrogram
def distance(lat1, long1, lat2, long2):
"""return distance between two ... | {
"repo_name": "neoyk/search",
"path": "maps/linkage.py",
"copies": "1",
"size": "2728",
"license": "apache-2.0",
"hash": 6940699185254979000,
"line_mean": 33.1,
"line_max": 105,
"alpha_frac": 0.6561583578,
"autogenerated": false,
"ratio": 2.971677559912854,
"config_test": false,
"has_no_keywo... |
#! /bin/env python
# -*- coding: utf-8 -*-
import os
import argparse
import requests
from harvester.solr_updater import delete_solr_collection
def confirm_deletion(cid):
prompt = "Are you sure you want to delete all solr " + \
"documents for %s? yes to confirm\n" % cid
while True:
ans = ra... | {
"repo_name": "barbarahui/harvester",
"path": "scripts/delete_solr_collection.py",
"copies": "3",
"size": "2728",
"license": "bsd-3-clause",
"hash": 126856314829035120,
"line_mean": 45.2203389831,
"line_max": 79,
"alpha_frac": 0.7209387605,
"autogenerated": false,
"ratio": 4.328571428571428,
"c... |
#!/bin/env python
#!-*-coding:utf-8-*-
import os
import sys
FILELOG = 'files.log'
PRESHELL = 'pre.sh'
class RollBack:
def __init__(self):
self.verNo = sys.argv[1]
self.relDir = sys.argv[2]
self.wwwDir = sys.argv[3]
#解压压缩包
os.system('mkdir -p %s/%s' % (self.relDir, self.verNo))
os.system('tar zxvf %s/%s.tar... | {
"repo_name": "webluoye/code-publish",
"path": "bin/rollback.py",
"copies": "1",
"size": "2135",
"license": "mit",
"hash": -4179361985005925000,
"line_mean": 28.0142857143,
"line_max": 103,
"alpha_frac": 0.6159527326,
"autogenerated": false,
"ratio": 2.2148309705561613,
"config_test": false,
... |
#!/bin/env python
#!-*-coding:utf-8-*-
import os
import sys
import shutil
FILELOG = 'files.log'
PRESHELL = 'pre.sh'
class Server:
def __init__(self, verNo, relDir, wwwDir):
self.verNo = verNo
self.relDir = relDir
self.wwwDir = wwwDir
#解压压缩包
os.system('mkdir -p %s/%s' % (self.relDir, self.verNo))
os.system(... | {
"repo_name": "webluoye/code-publish",
"path": "bin/release.py",
"copies": "1",
"size": "4252",
"license": "mit",
"hash": 1245699400289756400,
"line_mean": 30.9837398374,
"line_max": 127,
"alpha_frac": 0.603202847,
"autogenerated": false,
"ratio": 2.216338028169014,
"config_test": false,
"has... |
#!/bin/env python
#-*-coding:utf-8-*-
import os
import sys
import string
import time
import datetime
import MySQLdb
import logging
import logging.config
logging.config.fileConfig("etc/logger.ini")
logger = logging.getLogger("alert_main")
path='./include'
sys.path.insert(0,path)
import functions as func
import sendmail
... | {
"repo_name": "JK-Warriors/Heimdallr",
"path": "python/alert_main.py",
"copies": "1",
"size": "9215",
"license": "apache-2.0",
"hash": -7344894243702377000,
"line_mean": 30.6666666667,
"line_max": 138,
"alpha_frac": 0.4641345632,
"autogenerated": false,
"ratio": 3.730769230769231,
"config_test"... |
#!/bin/env python
#coding:utf-8
import os
import sys
import string
import time
import datetime
import MySQLdb
import logging
import logging.config
logging.config.fileConfig("etc/logger.ini")
logger = logging.getLogger("lepus")
path='./include'
sys.path.insert(0,path)
import functions as func
from multiprocessing import... | {
"repo_name": "stanxii/indexRiver",
"path": "data-lepus/lepus/lepus.py",
"copies": "1",
"size": "2909",
"license": "apache-2.0",
"hash": 6150738567231009000,
"line_mean": 29.3020833333,
"line_max": 94,
"alpha_frac": 0.5929872809,
"autogenerated": false,
"ratio": 3.753548387096774,
"config_test"... |
#!/bin/env python
#-*-coding:utf-8-*-
import os
import sys
import string
import time
import datetime
import MySQLdb
import logging
import logging.config
logging.config.fileConfig("etc/logger.ini")
logger = logging.getLogger("lepus")
path='./include'
sys.path.insert(0,path)
import functions as func
import sendmail
impor... | {
"repo_name": "stanxii/indexRiver",
"path": "data-lepus/lepus/alarm.py",
"copies": "1",
"size": "73218",
"license": "apache-2.0",
"hash": 150902668795299940,
"line_mean": 71.0649606299,
"line_max": 595,
"alpha_frac": 0.6081564643,
"autogenerated": false,
"ratio": 3.3831438868866095,
"config_tes... |
#!//bin/env python
#coding:utf-8
import os
import sys
import string
import time
import datetime
import MySQLdb
import logging
import logging.config
logging.config.fileConfig("etc/logger.ini")
logger = logging.getLogger("lepus")
path='./include'
sys.path.insert(0,path)
import functions as func
import thread
from multipr... | {
"repo_name": "stanxii/indexRiver",
"path": "data-lepus/lepus/check_os.py",
"copies": "1",
"size": "2892",
"license": "apache-2.0",
"hash": 420308431869054660,
"line_mean": 36.0769230769,
"line_max": 170,
"alpha_frac": 0.6071922545,
"autogenerated": false,
"ratio": 3.378504672897196,
"config_te... |
#!/bin/env python
#coding:utf-8
import os
import sys
import string
import time
import datetime
import MySQLdb
import logging
import logging.config
logging.config.fileConfig("etc/logger.ini")
logger = logging.getLogger("wlblazers")
path='./include'
sys.path.insert(0,path)
import functions as func
from multiprocessing im... | {
"repo_name": "JK-Warriors/Heimdallr",
"path": "python/wlblazers.py",
"copies": "1",
"size": "2511",
"license": "apache-2.0",
"hash": -4971942148137426000,
"line_mean": 28.1976744186,
"line_max": 89,
"alpha_frac": 0.5890083632,
"autogenerated": false,
"ratio": 3.7035398230088497,
"config_test":... |
#!/bin/env python
#-*-coding:utf-8-*-
import os
import sys
import string
import time
import datetime
import MySQLdb
import logging
import logging.config
logging.config.fileConfig("etc/logger.ini")
logger = logging.getLogger("wlblazers")
path='./include'
sys.path.insert(0,path)
import functions as func
import sendmail
i... | {
"repo_name": "JK-Warriors/Heimdallr",
"path": "python/alarm.py",
"copies": "1",
"size": "81692",
"license": "apache-2.0",
"hash": 6049866737927612000,
"line_mean": 68.8222222222,
"line_max": 591,
"alpha_frac": 0.6023600842,
"autogenerated": false,
"ratio": 3.368186690855117,
"config_test": fal... |
#!//bin/env python
#coding:utf-8
import os
import sys
import string
import time
import datetime
import MySQLdb
path='./include'
sys.path.insert(0,path)
import functions as func
from multiprocessing import Process;
def admin_mysql_purge_binlog(host,port,user,passwd,binlog_store_days):
datalist=[]
try:
... | {
"repo_name": "JK-Warriors/Heimdallr",
"path": "python/admin_mysql_purge_binlog.py",
"copies": "1",
"size": "2110",
"license": "apache-2.0",
"hash": -5622423268325277000,
"line_mean": 33.5901639344,
"line_max": 141,
"alpha_frac": 0.6028436019,
"autogenerated": false,
"ratio": 3.4703947368421053,
... |
#!/bin/env python
#coding:utf8
import os
import sys
import urllib2
import urllib
import json
import socket
import time
import traceback
import threading
'''
return code:
= 200: success
> 200: fail
< 200: checker fail
'''
TIMEOUT=5
METRIC="duimonitor_service"
DEBUG=True
socket.setdefaulttimeout(TIMEOUT)
DEFAUL... | {
"repo_name": "dengxiangyu768/dengxytools",
"path": "promethues/monitor_backend.py",
"copies": "1",
"size": "3263",
"license": "apache-2.0",
"hash": 9112300009184135000,
"line_mean": 22.9926470588,
"line_max": 82,
"alpha_frac": 0.6270303402,
"autogenerated": false,
"ratio": 3.1314779270633397,
... |
#! /bin/env python
# -*- coding: utf-8 -*-
import os,sys,threading,time,re,shlex,subprocess,urllib,urlparse, logging, logging.handlers, glob, signal, locale, math
import MySQLdb, maxminddb, IPy
import dns.resolver #install dnspython first http://www.dnspython.org/
ISOTIMEFORMAT='%Y-%m-%d %X'
dirname, _ = os.path.split... | {
"repo_name": "neoyk/raspberry",
"path": "webcrawl.py",
"copies": "1",
"size": "27298",
"license": "apache-2.0",
"hash": -3319210035877106000,
"line_mean": 47.5729537367,
"line_max": 249,
"alpha_frac": 0.5408454832,
"autogenerated": false,
"ratio": 3.538302009073234,
"config_test": false,
"ha... |
#/bin/env python
# -*-coding:utf=8 -*-
import os,time,subprocess,shlex
import urllib2
def upload_yeelink(image_name, log_file):
url = 'http://api.yeelink.net/v1.0/device/719/sensor/8613/photos'
length = os.path.getsize(image_name)
image_data = open(image_name, 'rb')
request = urllib2.Request(url, data=i... | {
"repo_name": "coolbit-in/yeelink_photos_upload",
"path": "main.py",
"copies": "1",
"size": "1190",
"license": "mit",
"hash": -9145027343907173000,
"line_mean": 43.0740740741,
"line_max": 105,
"alpha_frac": 0.6336134454,
"autogenerated": false,
"ratio": 2.853717026378897,
"config_test": false,
... |
#!/bin/env python
#-*- coding: utf-8 -*-
import paramiko
import sys
import os
import argparse
import logging
def __help__():
print """
Desp:Excute a remote command or push/pull a file to/from remote server.
version: 1.0.3
Editer:yaungzhou
Usage: ./remote_exec.py ip username password -c|-f|-fc|-g cmd|file
-c ... | {
"repo_name": "51reboot/actual_09_homework",
"path": "11/zhouyang/remote_exec.py",
"copies": "1",
"size": "4212",
"license": "mit",
"hash": -1529499434586351600,
"line_mean": 34.6090909091,
"line_max": 98,
"alpha_frac": 0.6123595506,
"autogenerated": false,
"ratio": 3.040372670807453,
"config_t... |
#!/bin/env python
#coding:utf-8
import random
import math
def classification(data,class_num):
M = 10
C = 0
data_num = len(data)
data_dimension = len(data[0])
classification = [0] * data_num
for i in range(data_num):
classification[i] = random.randint(0,class_num-1)
centroid = [[ 0.0... | {
"repo_name": "kato-masahiro/particle_filter_on_episode",
"path": "k_means.py",
"copies": "1",
"size": "1996",
"license": "mit",
"hash": -3433950977588694000,
"line_mean": 33,
"line_max": 97,
"alpha_frac": 0.5660474716,
"autogenerated": false,
"ratio": 3.47935368043088,
"config_test": false,
... |
#!/bin/env python
#coding:utf-8
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
# 邮件服务器
host = "smtp.163.com"
# 邮件标题
title = u"服务器日常流量监控"
# 收件人
send_to = "******@eycode.com"
# 发件人
send_from = "******@163.com"
# 读取图片文件,值得注意是读... | {
"repo_name": "zaxlct/python-django-learning",
"path": "SendMail/发送图片.py",
"copies": "1",
"size": "1656",
"license": "mit",
"hash": -5539687194594700000,
"line_mean": 19.4722222222,
"line_max": 74,
"alpha_frac": 0.6112618725,
"autogenerated": false,
"ratio": 2.2401215805471124,
"config_test": f... |
#!/bin/env python
# coding:utf-8
import socket
import select
listen_fd = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
listen_fd.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
listen_fd.bind(("0.0.0.0", 8828))
listen_fd.listen(10)
epoll_sock = select.epoll()
epoll_sock.register(listen_fd.fileno(), select.... | {
"repo_name": "iimianmian/pyscripts",
"path": "epoll_test.py",
"copies": "1",
"size": "1506",
"license": "apache-2.0",
"hash": 3599457491845986300,
"line_mean": 33.2272727273,
"line_max": 71,
"alpha_frac": 0.515936255,
"autogenerated": false,
"ratio": 3.4780600461893765,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
import sqlite3
import time,sys
import os.path as osp
class Db():
conn = ''
cursor = ''
sql = ''
def __init__(self, dbname):
#check_same_thread=False
try:
self.conn = sqlite3.connect(osp.abspath(dbname))
except Excepti... | {
"repo_name": "ptphp/PyLib",
"path": "src/fangte/sqlModel.py",
"copies": "1",
"size": "3901",
"license": "apache-2.0",
"hash": -8288045426591984000,
"line_mean": 26.0902777778,
"line_max": 81,
"alpha_frac": 0.4537298129,
"autogenerated": false,
"ratio": 4.277412280701754,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
import sqlite3
import time,sys
import os.path as osp
class Db():
conn = ''
cursor = ''
sql = ''
def __init__(self, dbname):
try:
self.conn = sqlite3.connect(osp.abspath(dbname))
except Exception, what:
print what
... | {
"repo_name": "ptphp/PyLib",
"path": "src/pyqt4/fangtee/sqlModel.py",
"copies": "1",
"size": "3102",
"license": "apache-2.0",
"hash": 7627659135293162000,
"line_mean": 25.0672268908,
"line_max": 81,
"alpha_frac": 0.4497098646,
"autogenerated": false,
"ratio": 4.197564276048714,
"config_test": f... |
#! /bin/env python
# coding: utf8
import subprocess
import sys
import tempfile
import time
from datetime import datetime
import RPi.GPIO as GPIO
import local_ftp
CAMERA_PROGRAM = 'raspistill'
GPIO_SOCKET_NUMBER = 26
def get_image_bytes():
return subprocess.check_output([CAMERA_PROGRAM, '-o', '-'])
def install... | {
"repo_name": "dawncold/home-monitor",
"path": "monitor.py",
"copies": "1",
"size": "1687",
"license": "mit",
"hash": 3797527792144804400,
"line_mean": 22.1232876712,
"line_max": 84,
"alpha_frac": 0.5678719621,
"autogenerated": false,
"ratio": 4.007125890736342,
"config_test": false,
"has_no_... |
#!/bin/env python
#coding:utf-8
import sys,argparse
import optparse
import os
import shutil
import subprocess
import datetime
from logging import *
from traceback import *
import datetime
import time
import fileinput
class LogHelper:
__logger = None
__logFile = None
@staticmethod
def info(message):
... | {
"repo_name": "stanxii/indexRiver",
"path": "SRE_shell/system-init.py",
"copies": "1",
"size": "8328",
"license": "apache-2.0",
"hash": 742627589316099600,
"line_mean": 37.5601851852,
"line_max": 140,
"alpha_frac": 0.6999279539,
"autogenerated": false,
"ratio": 3.2266563347539714,
"config_test"... |
#! /bin/env python
# -*- coding: utf-8 -*-
import sys
import logbook
from harvester.config import config as config_harvest
from redis import Redis
from rq import Queue
JOB_TIMEOUT = 28800 # 8 hrs
def def_args():
import argparse
parser = argparse.ArgumentParser(
description='Batch update field with n... | {
"repo_name": "barbarahui/harvester",
"path": "scripts/queue_batch_update_couchdb.py",
"copies": "1",
"size": "4442",
"license": "bsd-3-clause",
"hash": -409417692868844900,
"line_mean": 37.6173913043,
"line_max": 108,
"alpha_frac": 0.6444494483,
"autogenerated": false,
"ratio": 4.25790987535954,... |
#! /bin/env python
# -*- coding: utf-8 -*-
import sys
import logbook
from rq import Queue
from redis import Redis
from harvester.config import parse_env
JOB_TIMEOUT = 345600 # 96 hrs
def queue_deep_harvest_folder(redis_host,
redis_port,
redis_password,
... | {
"repo_name": "ucldc/harvester",
"path": "scripts/queue_deep_harvest_folder.py",
"copies": "1",
"size": "4093",
"license": "bsd-3-clause",
"hash": 5535963051679349000,
"line_mean": 37.6037735849,
"line_max": 82,
"alpha_frac": 0.6639784946,
"autogenerated": false,
"ratio": 4.1755102040816325,
"c... |
import sys
import os
import HTMLTestRunner
import time
from unittest import makeSuite, TestSuite
__author__ = 'ipinak'
def run_tests(test_cases, location='', title=None, description=None):
suite = TestSuite()
[suite.addTest(makeSuite(tc)) for tc in test_cases]
timestamp = time.strftime('%Y_%m_%d__%H_%M_... | {
"repo_name": "ipinak/naftis",
"path": "test/tools.py",
"copies": "1",
"size": "1244",
"license": "mit",
"hash": -5219714708092254000,
"line_mean": 26.6444444444,
"line_max": 72,
"alpha_frac": 0.6012861736,
"autogenerated": false,
"ratio": 4.105610561056106,
"config_test": true,
"has_no_keywo... |
#!/bin/env python
#coding=utf-8
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/vendor/')
import tornado
import tornado.options
import tornado.ioloop
import tornado.web
import tornado.websocket
import tornado.escape
import... | {
"repo_name": "hotpoor-for-Liwei/hj_hackathon_201607",
"path": "test_web.py",
"copies": "1",
"size": "47054",
"license": "mit",
"hash": 2831597814653986000,
"line_mean": 43.6311239193,
"line_max": 261,
"alpha_frac": 0.5358257463,
"autogenerated": false,
"ratio": 3.531276126776621,
"config_test"... |
# Acknowledgements:
# Nicolas Economou, for his command line debugger on which this is inspired.
# http://tinyurl.com/nicolaseconomou
# Copyright (c) 2009-2016, Mario Vilas
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the f... | {
"repo_name": "debasishm89/OpenXMolar",
"path": "ExtDepLibs/winappdbg/interactive.py",
"copies": "1",
"size": "85897",
"license": "bsd-3-clause",
"hash": 3693232598538051000,
"line_mean": 36.5916849015,
"line_max": 89,
"alpha_frac": 0.5372015321,
"autogenerated": false,
"ratio": 4.208986671893375... |
#!/bin/env python
# -*- coding: utf-8 -*-
'''A phylogenetic hierarchy that would have made Linnaeus proud.'''
INCOMPATIBLE_SPECIES = (set(("human", "lion")),
set(("dog", "cat")),
set(("cat", "mouse")))
class Animal(object):
"""An animal from the planet Earth."""... | {
"repo_name": "FullStackEmbedded/fse2016-python",
"path": "objects_and_inheritance.py",
"copies": "1",
"size": "4809",
"license": "mit",
"hash": -5962223731582195000,
"line_mean": 27.1169590643,
"line_max": 79,
"alpha_frac": 0.5461730449,
"autogenerated": false,
"ratio": 3.6204819277108435,
"co... |
#!/bin/env python
#coding:utf-8
"""
APIとしてユーザが用いる関数を提供する
"""
import copy
import os
from likelihood_function import likelihood_function
from functions import sensor_update
from functions import retrospective_resetting
from functions import particles_resampling
from functions import decision_making
from functions import ... | {
"repo_name": "kato-masahiro/particle_filter_on_episode",
"path": "PFoE_module/pfoe.py",
"copies": "1",
"size": "6474",
"license": "mit",
"hash": -8297772919354838000,
"line_mean": 34.8846153846,
"line_max": 159,
"alpha_frac": 0.5898535191,
"autogenerated": false,
"ratio": 2.7267413541159278,
"... |
__author__ = 'diego.zhu'
__email__ = 'zhuhaiyang55@gmail.com'
import getopt
import psycopg2
import psycopg2.extras
import traceback
import json
import time
import socket
import os
import re
import sys
import commands
import urllib2, base64
debug = False
timestamp = int(time.time())
falconAgentUrl = 'http://127.0.0.1... | {
"repo_name": "diegozhu/redialcon",
"path": "redialcon.py",
"copies": "1",
"size": "6627",
"license": "mit",
"hash": -5777846321266430000,
"line_mean": 31.3990147783,
"line_max": 132,
"alpha_frac": 0.542952714,
"autogenerated": false,
"ratio": 3.4561219127693117,
"config_test": false,
"has_no... |
__author__ = 'diego.zhu'
__email__ = 'zhuhaiyang55@gmail.com'
import json
import time
import socket
import os
import re
import sys
import getopt
import commands
import urllib2, base64
import psycopg2
import psycopg2.extras
import traceback
debug = False
timestamp = int(time.time())
falconAgentUrl = 'http://127.0.0.1... | {
"repo_name": "diegozhu/postgralcon",
"path": "postgralcon.py",
"copies": "1",
"size": "13151",
"license": "mit",
"hash": 2873742775226189300,
"line_mean": 34.072,
"line_max": 154,
"alpha_frac": 0.5817048133,
"autogenerated": false,
"ratio": 3.4827860169491527,
"config_test": false,
"has_no_k... |
__author__="g"
__date__ ="$2013-08-19 16:07:47$"
import os
import sys
import sched
import time
import commands
import re
from copy import deepcopy
import urllib2
from urllib import urlencode
import platform
if platform.python_version() >= 2.6:
import json
else:
import simplejson as json
class STDCollector... | {
"repo_name": "CodeMySky/node-monitor",
"path": "crawler/troy.py",
"copies": "1",
"size": "4138",
"license": "mit",
"hash": -6691242047879222000,
"line_mean": 27.7361111111,
"line_max": 145,
"alpha_frac": 0.529482842,
"autogenerated": false,
"ratio": 3.7789954337899543,
"config_test": false,
... |
__author__ = 'iambocai'
import json
import time
import socket
import os
import re
import sys
import commands
import urllib2, base64
class RedisStats:
# 如果你是自己编译部署到redis,请将下面的值替换为你到redis-cli路径
_redis_cli = '/usr/local/redis/redis-cli'
_stat_regex = re.compile(ur'(\w+):([0-9]+\.?[0-9]*)\r')
def __init... | {
"repo_name": "lilien1010/web_install",
"path": "falcon-monit-scripts/redis/redis-monitor.py",
"copies": "1",
"size": "4170",
"license": "mit",
"hash": 4364106468213355000,
"line_mean": 31.2786885246,
"line_max": 119,
"alpha_frac": 0.5289487049,
"autogenerated": false,
"ratio": 3.186084142394822,... |
__author__ = 'iambocai'
import sys, urllib2, base64, json, time,socket
step = 60
ip = socket.gethostname()
ts = int(time.time())
keys = ('messages_ready', 'messages_unacknowledged')
rates = ('ack', 'deliver', 'deliver_get', 'publish')
request = urllib2.Request("http://%s:15672/api/queues" %ip)
# see #issue4
base64... | {
"repo_name": "lilien1010/web_install",
"path": "falcon-monit-scripts/rabbitmq/rabbitmq-monitor.py",
"copies": "1",
"size": "2052",
"license": "mit",
"hash": 1902385946766409000,
"line_mean": 23.1411764706,
"line_max": 72,
"alpha_frac": 0.6189083821,
"autogenerated": false,
"ratio": 2.67885117493... |
__author__ = 'rublog'
import logging
import re
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)
fh = loggin... | {
"repo_name": "xinyu3ru/rublog",
"path": "recheck.py",
"copies": "1",
"size": "1444",
"license": "apache-2.0",
"hash": 5325976869845232000,
"line_mean": 31.8181818182,
"line_max": 101,
"alpha_frac": 0.5644044321,
"autogenerated": false,
"ratio": 3.266968325791855,
"config_test": false,
"has_n... |
__author__ = 'rublog'
import logging
import requests
import os
import re
import time
import random
from tqdm import tqdm
from fake_useragent import UserAgent
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(as... | {
"repo_name": "xinyu3ru/rublog",
"path": "read_log.py",
"copies": "1",
"size": "1189",
"license": "apache-2.0",
"hash": 303750292800547500,
"line_mean": 23.1020408163,
"line_max": 85,
"alpha_frac": 0.6308213378,
"autogenerated": false,
"ratio": 3.140957446808511,
"config_test": false,
"has_no... |
__author__ = 'rublog'
import logging
import requests
import os
import time
import random
from tqdm import tqdm
from fake_useragent import UserAgent
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - ... | {
"repo_name": "xinyu3ru/rublog",
"path": "download_pdf.py",
"copies": "1",
"size": "3303",
"license": "apache-2.0",
"hash": -979685176505014800,
"line_mean": 34.597826087,
"line_max": 133,
"alpha_frac": 0.4909923664,
"autogenerated": false,
"ratio": 3.717366628830874,
"config_test": false,
"h... |
__author__ = 'rublog'
import requests
import re
import time
import random
import os
import shutil
from tqdm import tqdm
import config
import json
import getpass
def clear():
os.system('cls || clear')
class Renren(object):
def __init__(self):
self.is_login = 0
self.params = {'origURL': 'h... | {
"repo_name": "xinyu3ru/renren-bak",
"path": "Renren.py",
"copies": "1",
"size": "41902",
"license": "apache-2.0",
"hash": -6954382452258668000,
"line_mean": 37.0198412698,
"line_max": 158,
"alpha_frac": 0.4841091744,
"autogenerated": false,
"ratio": 2.9000378357926597,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
Basic CLI script to manually upload a torrent to the configured backend client
./tranny-add torrent1.torrent torrent2.torrent..
"""
from __future__ import unicode_literals
from os.path import dirname
from sys import argv, path, exit
# silly hack for development purposes
... | {
"repo_name": "leighmacdonald/tranny",
"path": "scripts/tranny-add.py",
"copies": "1",
"size": "1766",
"license": "bsd-3-clause",
"hash": -8173653425715684000,
"line_mean": 28.9322033898,
"line_max": 122,
"alpha_frac": 0.5730464326,
"autogenerated": false,
"ratio": 4.165094339622642,
"config_te... |
#!/bin/env python
# -*- coding: UTF-8 -*-
#
# (c) Chiara Malagoli
#
# v 0.0.1.2
#
# file: mailmetheerror.py
# auth: Chiara Malagoli <malagoli@gbinside.com>
# desc:
#
# $Id: mailmetheerror.py 2016/04/12 23.56.00 chiara $
# --------------
import sys
import traceback
FROM = 'ircbot@gbinside.com'
TO = 'malagoli@gbinside.... | {
"repo_name": "malagolichiara/ircbot",
"path": "ircbot/mailmetheerror.py",
"copies": "1",
"size": "1048",
"license": "unlicense",
"hash": -8338537678087184000,
"line_mean": 19.5490196078,
"line_max": 70,
"alpha_frac": 0.5811068702,
"autogenerated": false,
"ratio": 2.9273743016759775,
"config_te... |
#!/bin/env python
## -*- coding: utf-8 -*-
class color:
BLUE = '\033[1;34m'
BLUEL = '\033[0;34m'
GREEN = '\033[1;32m'
GREENL = '\033[0;32m'
CYAN = '\033[1;36m'
CYANL = '\033[0;36m'
RED = '\033[1;31m'
REDL = '\033[0;31m'
PURPLE = '\033[1;35m'
PURPLEL = '\033[0;35m'
YELLOW = '... | {
"repo_name": "aminamid/pp",
"path": "colorpp.py",
"copies": "1",
"size": "4249",
"license": "mit",
"hash": 1679359926949529300,
"line_mean": 32.992,
"line_max": 123,
"alpha_frac": 0.5495410685,
"autogenerated": false,
"ratio": 3.035,
"config_test": false,
"has_no_keywords": false,
"few_ass... |
#!/bin/env python
# -*- coding: utf-8 -*-
class Route(object):
"""Class for modelling a CVRP route"""
def __init__(self, cvrp_problem, capacity):
"""Class constructor
Initialize route capacity
Parameters:
capacity: route capacity
"""
self._problem = cvrp_p... | {
"repo_name": "RomuloOliveira/monte-carlo-cvrp",
"path": "project/models.py",
"copies": "1",
"size": "6002",
"license": "apache-2.0",
"hash": -2998588533711390000,
"line_mean": 25.6755555556,
"line_max": 95,
"alpha_frac": 0.5306564479,
"autogenerated": false,
"ratio": 4.32732516222062,
"config_... |
#!/bin/env python
#-*- coding: utf-8 -*-
#Code for Binary Data Read
import struct
class EndOfFile(Exception):
pass
# UI32
def get_ui32(f):
try:
ret = struct.unpack(">I", f.read(4))[0]
except struct.error:
raise EndOfFile
return ret
def make_ui32(num):
return struct.pack(">I", num... | {
"repo_name": "kirisetsz/flvcopycat",
"path": "flvcopycat.py",
"copies": "1",
"size": "14765",
"license": "apache-2.0",
"hash": -2224789198976808700,
"line_mean": 28.9492900609,
"line_max": 119,
"alpha_frac": 0.5265831358,
"autogenerated": false,
"ratio": 3.645679012345679,
"config_test": false... |
# Command line debugger using WinAppDbg
# Show exception handlers list
# Copyright (c) 2009-2016, Mario Vilas
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source c... | {
"repo_name": "debasishm89/OpenXMolar",
"path": "ExtDepLibs/winappdbg/plugins/do_exchain.py",
"copies": "1",
"size": "2264",
"license": "bsd-3-clause",
"hash": 8659109706971271000,
"line_mean": 45.2040816327,
"line_max": 78,
"alpha_frac": 0.726590106,
"autogenerated": false,
"ratio": 4.1771217712... |
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | {
"repo_name": "22rostislav/xhtml2pdf",
"path": "xhtml2pdf/paragraph.py",
"copies": "1",
"size": "23959",
"license": "apache-2.0",
"hash": -732132735916415900,
"line_mean": 28.1790499391,
"line_max": 189,
"alpha_frac": 0.5026715645,
"autogenerated": false,
"ratio": 4.149662220682488,
"config_tes... |
"""Parser for Apple's binary plist (Property List) files.
Based on the specification at:
http://opensource.apple.com/source/CF/CF-550/CFBinaryPList.c
To parse a plist from a file you can use the readPlist(fileOrObj) function
with a file name or a file-like object. It returns the top level object,
which will usuall... | {
"repo_name": "ohio813/binplist",
"path": "binplist/binplist.py",
"copies": "3",
"size": "34465",
"license": "apache-2.0",
"hash": 8503964373453422000,
"line_mean": 34.3125,
"line_max": 80,
"alpha_frac": 0.6581169302,
"autogenerated": false,
"ratio": 3.8230726566833058,
"config_test": false,
... |
"""Tests for binplist."""
import datetime
import logging
import os
import random
import StringIO
import unittest
from binplist import binplist
import pytz
class BinplistTest(unittest.TestCase):
def setUp(self):
notrailer = "bplist00" # header
self.notrailer = StringIO.StringIO(notrailer)
# A bplist... | {
"repo_name": "JD86/binplist",
"path": "tests/binplist_test.py",
"copies": "3",
"size": "27535",
"license": "apache-2.0",
"hash": -5383416043632188000,
"line_mean": 36.3120759837,
"line_max": 80,
"alpha_frac": 0.5766391505,
"autogenerated": false,
"ratio": 3.227582159624413,
"config_test": true... |
# Copyright (c) 2009-2016, Mario Vilas
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of condit... | {
"repo_name": "debasishm89/OpenXMolar",
"path": "ExtDepLibs/winappdbg/disasm.py",
"copies": "1",
"size": "25469",
"license": "bsd-3-clause",
"hash": 6179958988644988000,
"line_mean": 32.4238845144,
"line_max": 79,
"alpha_frac": 0.5575405395,
"autogenerated": false,
"ratio": 4.71299037749815,
"c... |
# Copyright (C) 2014 Mathias Teulé <mathias.te@googlemail.com>
# TODO: Split attributes into Last_Meterings() and DBMS_Manager()
# TODO: Docstrings
# TODO: nosetest dir ../tests -> tests to have autocode in sphinx
# TODO: Size of strings in the Dia Diagram.
# TODO: Latin-1, utf-8 and db_url: Check the problems we'll ... | {
"repo_name": "mteule/StationMeteo",
"path": "station_meteo/station.py",
"copies": "1",
"size": "6170",
"license": "mit",
"hash": 2044154216184628000,
"line_mean": 33.0828729282,
"line_max": 80,
"alpha_frac": 0.5498460042,
"autogenerated": false,
"ratio": 3.75700365408039,
"config_test": false,... |
"""Simple example of basic operations with ROOT histograms
"""
# =============================================================================
from __future__ import print_function
import ROOT
from ostap.histos import VE
h1 = ROOT.TH1F('h1','title',20,0,1)
## 1) set values for some bins
for i in h1 :
h1[i] =... | {
"repo_name": "OstapHEP/ostap",
"path": "examples/histos/histos_ex001_basic.py",
"copies": "1",
"size": "1619",
"license": "bsd-3-clause",
"hash": -1563862366488930300,
"line_mean": 37.5476190476,
"line_max": 79,
"alpha_frac": 0.3736874614,
"autogenerated": false,
"ratio": 3.550438596491228,
"c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.