text stringlengths 0 1.05M | meta dict |
|---|---|
#!/bin/python
"""
Write a function to tell us if a full deck of cards shuffled_deck is a single riffle of two other halves half1 and half2.
We'll represent a stack of cards as a list of integers in the range 1..521..52 (since there are 5252 distinct cards in a deck).
Why do I care? A single riffle is not a completely... | {
"repo_name": "bt3gl/Python-and-Algorithms-and-Data-Structures",
"path": "First_edition_2014/other_resources/interview_cake/strings/online_poker.py",
"copies": "1",
"size": "1220",
"license": "mit",
"hash": 4503416068481827300,
"line_mean": 42.6071428571,
"line_max": 294,
"alpha_frac": 0.6713114754,
... |
#!/bin/python
"""
You are given a square map of size . Each cell of the map has a value denoting its depth. We will call a cell of the map a cavity if and only if this cell is not on the border of the map and each cell adjacent to it has strictly smaller depth. Two cells are adjacent if they have a common side (edge).... | {
"repo_name": "codecakes/algorithms_monk",
"path": "search/grid_canvas_search.py",
"copies": "1",
"size": "2039",
"license": "mit",
"hash": -6352816364788556000,
"line_mean": 27.7323943662,
"line_max": 301,
"alpha_frac": 0.5890142227,
"autogenerated": false,
"ratio": 3.3814262023217245,
"config... |
#!/bin/python
"""
Your local library needs your help! Given the expected and actual return dates for a library book, create a program that calculates the fine (if any). The fee structure is as follows:
If the book is returned on or before the expected return date, no fine will be charged (i.e.: .
If the book is retur... | {
"repo_name": "codecakes/algorithms_monk",
"path": "implementation/library_fine.py",
"copies": "1",
"size": "2657",
"license": "mit",
"hash": -3787346095250554400,
"line_mean": 30.6428571429,
"line_max": 183,
"alpha_frac": 0.5954083553,
"autogenerated": false,
"ratio": 3.0470183486238533,
"conf... |
#!/bin/python
# Now unused functions that came up during the writing of meta.py.
# This script uses pandocfilters: https://github.com/jgm/pandocfilters
# the walk function in particular is a modified version of the one there. see the pandocfilters license (3-clause BSD) at: https://github.com/jgm/pandocfilters/blob/mas... | {
"repo_name": "riceissa/ssg-riceissa.com",
"path": "unused.py",
"copies": "1",
"size": "5073",
"license": "bsd-2-clause",
"hash": 4250854041157593000,
"line_mean": 32.1568627451,
"line_max": 179,
"alpha_frac": 0.5785531244,
"autogenerated": false,
"ratio": 3.628755364806867,
"config_test": fals... |
#/bin/python
# parse repo tree, collect todo's, generate todo file
# Unix tool inspiration
# grep, sed, cut, awk
import os
import os.path
import sys
import re
# single file grepping class
class Grepper:
def __init__(self):
self.matches = {}
self.is_empty = True
# pseudo grep method
def grep_file(self... | {
"repo_name": "61quisberth/autotodo",
"path": "gen_todo.py",
"copies": "1",
"size": "1530",
"license": "bsd-3-clause",
"hash": -9212027975457867000,
"line_mean": 22.90625,
"line_max": 76,
"alpha_frac": 0.6045751634,
"autogenerated": false,
"ratio": 3.053892215568862,
"config_test": false,
"ha... |
#!/bin/python
#
# porm - simple sqlite3 <-> python ORM layer
#
# This file provides very simple logic for conversion between rows of
# a database table and lists of python objects. It supports lookup of
# simple types, and of basic one-to-many foreign key references.
#
# The following assumptions are made:
#
# - All... | {
"repo_name": "pauldmccarthy/porm",
"path": "porm.py",
"copies": "1",
"size": "5933",
"license": "bsd-3-clause",
"hash": 1039989858914805600,
"line_mean": 28.2266009852,
"line_max": 75,
"alpha_frac": 0.6467217259,
"autogenerated": false,
"ratio": 3.6759603469640645,
"config_test": false,
"has... |
fin = open('tbl_clusters_unlearnable_manual+5p.txt') # Input file, read in data
fout = open('Wb1_unlearnable_clusters.txt', 'w') # Output file, write out
def writeHeader(row):
'''
Write a header line to a file
This function writes the header of the
output file by reformatting the supplied
... | {
"repo_name": "KrbAlmryde/Utilities",
"path": "WordBoundary/wb1_unlearn_format.py",
"copies": "1",
"size": "5288",
"license": "mit",
"hash": 2234919209701206500,
"line_mean": 46.2142857143,
"line_max": 108,
"alpha_frac": 0.5397125567,
"autogenerated": false,
"ratio": 4.3956774729842065,
"config... |
#!/bin/python
"""
Program to illustrate multiprocess TCP echo client using Pyev module.
- Supports multiprocess model where master process launches workers and worker processes
each try to establish connections to given server independently.
- Each client socket does a bind on a explicitly provided pair o... | {
"repo_name": "jeeveeyes/pyev-test",
"path": "multi_proc_client.py",
"copies": "1",
"size": "15757",
"license": "bsd-3-clause",
"hash": 3009645140520943000,
"line_mean": 35.474537037,
"line_max": 760,
"alpha_frac": 0.5684457701,
"autogenerated": false,
"ratio": 3.872450233472598,
"config_test":... |
#!/bin/python
"""
Program to illustrate multiprocess TCP echo server using Pyev module.
- Supports multiprocess model where master process listens/accepts connections
and worker processes handles all established client connections.
- Master process distributes connected sockets to existing workers in a round rob... | {
"repo_name": "jeeveeyes/pyev-test",
"path": "multi_proc_server.py",
"copies": "1",
"size": "15335",
"license": "bsd-3-clause",
"hash": 4411020710204553000,
"line_mean": 36.4024390244,
"line_max": 760,
"alpha_frac": 0.5904792957,
"autogenerated": false,
"ratio": 3.936088295687885,
"config_test"... |
#!/bin/python
"""
Provides the 2 symbols MONGODB_HOST and MONGODB_PORT that are used my
minimingo to connect to the proper database.
Uses the following 3 strategies:
1. import os.environ['MINIMONGO_SETTINGS_MODULE']
2. import 'minimongo.app_config'
3. default values (localhost, 27017)
"""
import os
import sys
#######... | {
"repo_name": "terianil/minimongo",
"path": "minimongo/config.py",
"copies": "2",
"size": "2948",
"license": "bsd-2-clause",
"hash": 6790418383602699000,
"line_mean": 32.8850574713,
"line_max": 78,
"alpha_frac": 0.6251696065,
"autogenerated": false,
"ratio": 4.413173652694611,
"config_test": tr... |
#!/bin/python
# Purpose: read calib.txt and UT.txt from conTemp.sh and do math on them to get a temperature based on the datasheet:
# pg 15 https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf
import binascii
def main():
print "hi"
f = open('calib.txt', 'r')
f2 = open('UT.txt', 'r')
# initi... | {
"repo_name": "beasley-weather/bbg",
"path": "sensors/bmp180/calcTemp.py",
"copies": "1",
"size": "1735",
"license": "mit",
"hash": -1378126025202041600,
"line_mean": 16.0196078431,
"line_max": 117,
"alpha_frac": 0.5556195965,
"autogenerated": false,
"ratio": 2.2679738562091503,
"config_test": ... |
#!/bin/python
###############################################################
# Python script that converts camel case expressions to snake #
# case expressions. Useful for coding but doesn't smartly #
# ignore anything. You are supposed to check all this script #
# does. ... | {
"repo_name": "rzippert/camelTo_snake",
"path": "camelTo_snake.py",
"copies": "1",
"size": "2297",
"license": "mit",
"hash": -8563303003610940000,
"line_mean": 46.8541666667,
"line_max": 131,
"alpha_frac": 0.6047017849,
"autogenerated": false,
"ratio": 3.9064625850340136,
"config_test": false,
... |
#!/bin/python
'''
Quick and dirty utility to create a convex hull polygon around the data-containing area of a gridded NetCDF dataset
'''
from scipy.spatial import ConvexHull
import scipy.ndimage as ndimage
import numpy as np
import netCDF4
import gc
import sys
CHUNK_MULTIPLE = 256 # Number of chunks to grab in each ... | {
"repo_name": "alex-ip/geophys2netcdf",
"path": "hacks/grid2polygon.py",
"copies": "1",
"size": "3777",
"license": "apache-2.0",
"hash": 4489286375298138600,
"line_mean": 31.5603448276,
"line_max": 115,
"alpha_frac": 0.6044479746,
"autogenerated": false,
"ratio": 3.3844086021505375,
"config_tes... |
#!/bin/python
'''Quick Sort'''
def partition(ar, left, right):
shifts = 0
right_idx = right
left_idx = left
pivot = ar[right]
while left_idx < right_idx:
if ar[left_idx] >= pivot:
while left_idx < right_idx and ar[right_idx] >= pivot:
right_idx -= 1
... | {
"repo_name": "ernestoalarcon/competitiveprogramming",
"path": "quicksort4.py",
"copies": "1",
"size": "1571",
"license": "mit",
"hash": -7197519829798540000,
"line_mean": 23.5625,
"line_max": 73,
"alpha_frac": 0.5168682368,
"autogenerated": false,
"ratio": 3.0386847195357833,
"config_test": fa... |
#!/bin/python
# Remote control via keyboard from a shell, comfortable navigation e.g. when surfing
# with your laptop on the couch and watching tv in the background
import autodiscover
from tvcontrol import Remote
import curses
# simple hack to get the local ip. assumes that the network-IF which is used
# to connec... | {
"repo_name": "NoUsername/samsungremote",
"path": "cli.py",
"copies": "1",
"size": "1476",
"license": "mit",
"hash": 6147372900871158000,
"line_mean": 25.375,
"line_max": 84,
"alpha_frac": 0.6395663957,
"autogenerated": false,
"ratio": 2.6983546617915906,
"config_test": false,
"has_no_keyword... |
#!/bin/python
#requirements:
# lxml
# cssselect
from lxml import etree, html
import argparse
import re
import string
#contants
NEWLINE = '\n'
#regexes
heading_tag = re.compile('h([1-6])')
whitespace = re.compile('\s+')
sentence = re.compile('([^.?!]{2,}\.|\?\!)\s+') #matches the end of a sentence
fakelist = re.... | {
"repo_name": "nhynes/markdownify",
"path": "markdownify.py",
"copies": "1",
"size": "11024",
"license": "mit",
"hash": 7993727949667469000,
"line_mean": 35.5033112583,
"line_max": 197,
"alpha_frac": 0.50154209,
"autogenerated": false,
"ratio": 4.172596517789553,
"config_test": false,
"has_no... |
#!/bin/python
'''
Retrieve Youtube video *information*
'''
import requests
import elasticsearch
import json
import logging
from requests import ConnectTimeout, ConnectionError
import httplib2
import os
import datetime
from apiclient import discovery
from oauth2client import client
from oauth2client.client import Cre... | {
"repo_name": "ControCurator/controcurator",
"path": "python_code/youtube_scraping/youtube.py",
"copies": "1",
"size": "9986",
"license": "mit",
"hash": -603536362342837200,
"line_mean": 29.2606060606,
"line_max": 125,
"alpha_frac": 0.6799519327,
"autogenerated": false,
"ratio": 3.188378033205619... |
#!/bin/python
#
# Rui Martiniano 12/2015
#
# filter_vcf_GP.py - Filters VCF according to specified Genotype probability threshold
# usage:
# filter_vcf_GP.py [-h] [-i VCF_INPUT] [-o VCF_OUTPUT] [-t GENOTYPE_PROBABILITY_THRESHOLD]
# #example usage
# python filter_vcf_GP.py -i chr1.1.out.vcf -o test.out -t 0.90
from __... | {
"repo_name": "ruidlpm/Utils",
"path": "filter_vcf_GP.py",
"copies": "1",
"size": "3228",
"license": "mit",
"hash": 4022631205267176000,
"line_mean": 26.5897435897,
"line_max": 181,
"alpha_frac": 0.6827757125,
"autogenerated": false,
"ratio": 2.9107303877366997,
"config_test": false,
"has_no_... |
#!/bin/python
""" Runs a small test to check scores from AccuracyPerLabel Metric"""
def run_metric_test():
from metric import AccuracyPerLabel
import torch
metric = AccuracyPerLabel(num_labels=5)
# Round 1 through metric.
predictions = torch.Tensor([[4, 1, 2, 0, 0],
... | {
"repo_name": "sameersingh/uci-statnlp",
"path": "hw3/metric_test.py",
"copies": "1",
"size": "1566",
"license": "apache-2.0",
"hash": -2902990234501629400,
"line_mean": 36.2857142857,
"line_max": 79,
"alpha_frac": 0.5006385696,
"autogenerated": false,
"ratio": 3.276150627615063,
"config_test":... |
#!/bin/python
"""
Runs off-policy optimization of the degradable battery problem
"""
import numpy as np
import raam
from raam import examples
from raam import crobust
## Configuration
horizon = 2000 # maximal simulation horizon
runs = 1000 # maximal number of runs
sample_count = 1... | {
"repo_name": "marekpetrik/RAAM",
"path": "examples/energy/offpolicy.py",
"copies": "1",
"size": "2032",
"license": "mit",
"hash": 4986648974651332000,
"line_mean": 36.6296296296,
"line_max": 92,
"alpha_frac": 0.7219488189,
"autogenerated": false,
"ratio": 3.798130841121495,
"config_test": fals... |
#!/bin/python
"""
Runs on-policy optimization of the degradable battery problem. States are aggregated
and the importance weights are derived from something that amounts to a limiting
distribution.
"""
import numpy as np
import raam
from raam import examples
from raam import crobust
## Configuration
horizon = 2000 ... | {
"repo_name": "marekpetrik/RAAM",
"path": "examples/energy/onpolicy_limiting.py",
"copies": "1",
"size": "1965",
"license": "mit",
"hash": -7003122926220220000,
"line_mean": 36.0943396226,
"line_max": 95,
"alpha_frac": 0.7017811705,
"autogenerated": false,
"ratio": 3.9696969696969697,
"config_t... |
#!/bin/python
"""
Run trained detector with an image to get feature map
Usage: python patch_network_eval.py imagename.png --train_name mexico_tilde_p24_Mexico_train_point_translation_iter_20 --stats_name mexico_tilde_p24_Mexico_train_point --save_feature targetname.mat
General options:
--stats_name Name of the... | {
"repo_name": "spongezhang/vlb",
"path": "matlab/+features/+utls/tcdet_eval.py",
"copies": "2",
"size": "5879",
"license": "bsd-2-clause",
"hash": 226359776510547460,
"line_mean": 32.0280898876,
"line_max": 226,
"alpha_frac": 0.6453478483,
"autogenerated": false,
"ratio": 3.3158488437676255,
"c... |
#!/bin/python
#
# sahysmodIO.py
#
# Usage:
#
# CSV to INP:
# python sahysmodIO.py exampleIn.csv exampleOut.inp
#
# INP to CSV:
# python sahysmodIO.py exampleIn.inp exampleOut.csv
#
# jerome.boisvert-chouinard@mail.mcgill.ca
#
##########
import mioparser
import sys
from pprint import pprint
CSVTEMPLATE = 'sahysmod.csv... | {
"repo_name": "jbchouinard/mioparser",
"path": "sahysmodIO.py",
"copies": "2",
"size": "2121",
"license": "mit",
"hash": 6734245904632458000,
"line_mean": 20.6530612245,
"line_max": 93,
"alpha_frac": 0.5770862801,
"autogenerated": false,
"ratio": 3,
"config_test": false,
"has_no_keywords": fa... |
#!/bin/python
# SaucyPy Interface to SauceLabs API
# Written by Ewen McCahon, 2016
# Version 0.0.7
import json
import requests
from requests.auth import HTTPBasicAuth
if __name__ == "__main__":
print """
____ ____
/ ___| __ _ _ _ ___ _ _| _ \ _ _
\___ \ / _`... | {
"repo_name": "Neko-Design/saucypy",
"path": "saucypy/saucypy.py",
"copies": "1",
"size": "6549",
"license": "apache-2.0",
"hash": 7079406835987952000,
"line_mean": 31.4207920792,
"line_max": 92,
"alpha_frac": 0.5466483433,
"autogenerated": false,
"ratio": 3.928614277144571,
"config_test": fals... |
# scene_to_pcl.py
# voxels-at-lems
#
# Created by Isabel Restrepo on 11/2/11.
# Copyright (c) 2011 Brown University. All rights reserved.
import dbrec3d_batch;
import os;
import optparse;
dbrec3d_batch.register_processes();
dbrec3d_batch.register_datatypes();
class dbvalue:
def __init__(self, index, type):
... | {
"repo_name": "mirestrepo/voxels-at-lems",
"path": "dbrec3d/pcl/scene_to_pcl.py",
"copies": "1",
"size": "1863",
"license": "bsd-2-clause",
"hash": 7572951078299842000,
"line_mean": 34.8269230769,
"line_max": 137,
"alpha_frac": 0.757380569,
"autogenerated": false,
"ratio": 2.569655172413793,
"c... |
#!/bin/python
#############################
# Script to add timeout and/or memlimit parameter to test.desc
##############################
import fnmatch
import os
import shutil
import sys
import os
from sys import argv
import xml.etree.ElementTree as ET
STR_OPT = 'item_05_option_to_run_esbmc'
TIMEOUT_CONST = '3600s'
M... | {
"repo_name": "ssvlab/esbmc-gpu",
"path": "regression/esbmc-cpp/add_parameter.py",
"copies": "1",
"size": "4403",
"license": "apache-2.0",
"hash": -6694551655900365000,
"line_mean": 29.7902097902,
"line_max": 92,
"alpha_frac": 0.592096298,
"autogenerated": false,
"ratio": 3.763247863247863,
"co... |
#!/bin/python
#############################
# Script to create new file testllvm.desc from test.desc
# If the file does not exist, it will creat it
##############################
import os
import xml.etree.ElementTree as ET
import sys
from copy import copy
from sys import argv
def show_info(path):
#changing path
... | {
"repo_name": "ssvlab/esbmc-gpu",
"path": "regression/esbmc-cpp/convert_llbmc.py",
"copies": "1",
"size": "2805",
"license": "apache-2.0",
"hash": -2527701438084684300,
"line_mean": 27.05,
"line_max": 114,
"alpha_frac": 0.5607843137,
"autogenerated": false,
"ratio": 3.4801488833746896,
"config_... |
#!/bin/python
"""
Script to shrink tajectories by removing frames
"""
from os import sys
num_particles = 0
step_size = 1
inp = "trajectory.xyz"
out = "trjconv.xyz"
skip = -1
move = 0
max_z = 0
for i, val in enumerate(sys.argv):
if val == "-dt":
step_size = int(sys.argv[i+1])
if val == "-f":
in... | {
"repo_name": "danijoo/lj_monte_carlo",
"path": "trjconv.py",
"copies": "1",
"size": "1773",
"license": "cc0-1.0",
"hash": -8277582133086027000,
"line_mean": 25.4626865672,
"line_max": 90,
"alpha_frac": 0.5064861816,
"autogenerated": false,
"ratio": 3.265193370165746,
"config_test": false,
"h... |
#!/bin/python
# * Set entityID of SSO to primary IDP and remove discovery attributes
# * Add metadata provider for primary IDP
# * Add SimpleAggregation AttributeResolver config for AA IDP
import re
metadata_provider = """
<MetadataProvider type="XML" validate="true" path="/vagrant/metadata/idp-metadata.xml"... | {
"repo_name": "fedushare/ecp-ssh-demo-environment",
"path": "metadata-exchange/sp/edit-shib-conf.py",
"copies": "1",
"size": "1528",
"license": "mit",
"hash": 5032363430723754000,
"line_mean": 41.4444444444,
"line_max": 137,
"alpha_frac": 0.6655759162,
"autogenerated": false,
"ratio": 3.068273092... |
#!/bin/python
#
# simple restful client tester for the API application.
#
import requests
import json
import uuid
base_url = 'http://localhost:5000/'
user_name = 'test'
user_email = str(uuid.uuid4()) + "@example.net"
user_pass = '1234'
# register new user
print('=> Registering new user')
register = requests.post(ba... | {
"repo_name": "plastboks/Flaskmarks-API",
"path": "client/test.py",
"copies": "1",
"size": "3027",
"license": "mit",
"hash": 8372598659662196000,
"line_mean": 29.5757575758,
"line_max": 79,
"alpha_frac": 0.5477370334,
"autogenerated": false,
"ratio": 3.8075471698113206,
"config_test": false,
... |
#!/bin/python
# Simple script for reading shp-files.
# Caveat: not all exotic shapes are implemented yet.
import array
import struct
import sys
import io
# TODO refactor... use classes...
defaultbyteorder="little"
def putInt(f, v, byteorder=defaultbyteorder):
if byteorder == "little":
fmt = "<i"
el... | {
"repo_name": "jesajx/experiments",
"path": "shp/shp.py",
"copies": "1",
"size": "7827",
"license": "unlicense",
"hash": -1180149278554842600,
"line_mean": 25.8969072165,
"line_max": 78,
"alpha_frac": 0.5408202376,
"autogenerated": false,
"ratio": 3.347733105218135,
"config_test": false,
"has... |
#!/bin/python
# Source: https://www.hackerrank.com/challenges/magic-square-forming/problem (you need to be logged in!)
import math
import os
import random
import re
import sys
def is_magic_square(arr):
return \
arr[0] + arr[1] + arr[2] == \
arr[3] + arr[4] + arr[5] == \
arr[6] + arr[7] + ... | {
"repo_name": "topliceanu/learn",
"path": "python/hackerrank/magic_square_forming.py",
"copies": "1",
"size": "2159",
"license": "mit",
"hash": -3991340069652754400,
"line_mean": 24.1046511628,
"line_max": 104,
"alpha_frac": 0.5664659565,
"autogenerated": false,
"ratio": 3.0754985754985755,
"co... |
#!/bin/python
# source https://www.researchgate.net/publication/27382766_On_benchmarking_functions_for_genetic_algorithm
import random
import math
def evalRosenbrock(parameters):
Result = pow(1-parameters[0], 2)
Result += 100 * pow(pow(parameters[0], 2) - parameters[1], 2)
return -Result
def evalGriew... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "evaluation/benchmark/benchmark.py",
"copies": "1",
"size": "2541",
"license": "mit",
"hash": 15102651562750942,
"line_mean": 21.6875,
"line_max": 106,
"alpha_frac": 0.5545061,
"autogenerated": false,
"ratio": 3.1216216216216215,
"config_test": false... |
#!/bin/python
# standard imports:
from threading import Thread
from time import sleep
from random import randint
import socket,sys, select
import json
from pprint import *
import bitcoin
# own imports:
import jsonConn, hpUtils, txUtils
# Parameters to be, later on, inputed to the program (rather than harcoded)
clas... | {
"repo_name": "samnet/bybit",
"path": "uml/mngrCashier.py",
"copies": "1",
"size": "9111",
"license": "mit",
"hash": 5863330890792736000,
"line_mean": 27.832278481,
"line_max": 121,
"alpha_frac": 0.6738009,
"autogenerated": false,
"ratio": 3.004947229551451,
"config_test": false,
"has_no_keyw... |
#! /bin/python
# STANDARD PYTHON IMPORTS
import time
import argparse
import sys
import threading
# PYTHON LIBRARIES
import RPi.GPIO as GPIO
# USER LIBRARIES
from step_servo import ServoStepThread
# GLOBAL VARIABLES
DEFAULT_TIMEDELAY = 1 # second
# CLASSES
# FUNCTIONS
def measure_servo(pin):
''' Measures the t... | {
"repo_name": "plus44/hcr-2016",
"path": "src/pi/measure_servo.py",
"copies": "1",
"size": "1310",
"license": "apache-2.0",
"hash": 3513382303700909600,
"line_mean": 18.8484848485,
"line_max": 77,
"alpha_frac": 0.6290076336,
"autogenerated": false,
"ratio": 3.598901098901099,
"config_test": fal... |
#!/bin/python
"""
This code grades the HITs based on the embedded control tweets.
It takes as input the csv file containing the submitted HITs.
It outputs hits_graded.csv, which contains the columns 'Approve' and 'Reject', one of which contains an 'X' for each HIT, according to the Turker's performance on controls.
""... | {
"repo_name": "manosai/tweepy",
"path": "grade_hits_moresmarter_template.py",
"copies": "1",
"size": "5733",
"license": "mit",
"hash": -431205249725859600,
"line_mean": 46.775,
"line_max": 241,
"alpha_frac": 0.7226582941,
"autogenerated": false,
"ratio": 3.3062283737024223,
"config_test": false... |
#!/bin/python
"""
this code takes produces a csv file which contains data for one HIT per line
It takes no parameters, but assumes the existence of tweets.csv, which contains one tweet per line, each of which may be either labeled or unlabeled
It outputs tweets_with_controls.csv, which contains one HIT (10 tweets, incl... | {
"repo_name": "manosai/tweepy",
"path": "embed_controls.py",
"copies": "1",
"size": "2176",
"license": "mit",
"hash": 5531863024903635000,
"line_mean": 45.2978723404,
"line_max": 148,
"alpha_frac": 0.7412683824,
"autogenerated": false,
"ratio": 3.405320813771518,
"config_test": false,
"has_no... |
#!/bin/python
# This file contains a C-like preprocessor implementation for the
# nsbcomp compiler.
import os
import errno
import os.path
import time
import re
import strutils
import cli
import sys
DIR_TMP_FALLBACK = 'tmp';
def init():
global DIR_TMP, PRE_KEYWORDS, INCLUDE_PATHS;
DIR_TMP = DIR_TMP_FALLBACK;
PRE... | {
"repo_name": "eerotal/nsbcomp",
"path": "nsbcomp/preprocessor.py",
"copies": "1",
"size": "5056",
"license": "bsd-3-clause",
"hash": 990218194065392800,
"line_mean": 21.6726457399,
"line_max": 65,
"alpha_frac": 0.644778481,
"autogenerated": false,
"ratio": 2.734451054624121,
"config_test": fal... |
#!/bin/python
# this file contains functions for 'meta genetic algorithm',
# this acts to allow settings value manipulation via command line,
# making possible a simple GA of GAs under bash.
# TBD
from .parameterOperations import flattenParameters, expandNestedParameters
def generateCommandLineArguments(parser, set... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "promoterz/metaPromoterz.py",
"copies": "1",
"size": "1250",
"license": "mit",
"hash": -8208317920971758000,
"line_mean": 32.7837837838,
"line_max": 74,
"alpha_frac": 0.6432,
"autogenerated": false,
"ratio": 4.9800796812749,
"config_test": false,
"... |
# This file is part of INDXParse.
#
# Copyright 2011-13 Will Ballenthin <william.ballenthin@mandiant.com>
# while at Mandiant <http://www.mandiant.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... | {
"repo_name": "ohio813/INDXParse",
"path": "SDS.py",
"copies": "2",
"size": "14598",
"license": "apache-2.0",
"hash": 699187160637101400,
"line_mean": 30.5974025974,
"line_max": 98,
"alpha_frac": 0.6080284971,
"autogenerated": false,
"ratio": 3.3543198529411766,
"config_test": false,
"has_no_... |
# This file is part of INDXParse.
#
# Copyright 2011 Will Ballenthin <william.ballenthin@mandiant.com>
# while at Mandiant <http://www.mandiant.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You... | {
"repo_name": "ohio813/INDXParse",
"path": "MFT.py",
"copies": "1",
"size": "50512",
"license": "apache-2.0",
"hash": -8260647951936340000,
"line_mean": 34.2,
"line_max": 98,
"alpha_frac": 0.569745803,
"autogenerated": false,
"ratio": 3.8999382334774553,
"config_test": false,
"has_no_keywords... |
# This file is part of INDXParse.
#
# Copyright 2014 Will Ballenthin <william.ballenthin@mandiant.com>
# while at FireEye <http://www.FireEye.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You m... | {
"repo_name": "ohio813/INDXParse",
"path": "extract_mft_record_slack.py",
"copies": "2",
"size": "1155",
"license": "apache-2.0",
"hash": 2657632207061879000,
"line_mean": 29.3947368421,
"line_max": 76,
"alpha_frac": 0.6701298701,
"autogenerated": false,
"ratio": 3.643533123028391,
"config_test... |
# This file is part of python-registry.
#
# Copyright 2011, 2012 Willi Ballenthin <william.ballenthin@mandiant.com>
# while at Mandiant <http://www.mandiant.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lic... | {
"repo_name": "NiKiZe/python-registry",
"path": "Registry/RegistryLog.py",
"copies": "2",
"size": "7937",
"license": "apache-2.0",
"hash": -2819561045620136400,
"line_mean": 38.2920792079,
"line_max": 122,
"alpha_frac": 0.6329847549,
"autogenerated": false,
"ratio": 4.0167004048583,
"config_tes... |
# This file is part of python-registry.
#
# Copyright 2011 Will Ballenthin <william.ballenthin@mandiant.com>
# while at Mandiant <http://www.mandiant.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#... | {
"repo_name": "williballenthin/python-registry",
"path": "Registry/RegistryParse.py",
"copies": "1",
"size": "68760",
"license": "apache-2.0",
"hash": -8895666329288800000,
"line_mean": 33.8681541582,
"line_max": 132,
"alpha_frac": 0.5770651542,
"autogenerated": false,
"ratio": 4.016120553705975,... |
#!/bin/python
#
# This implements the composite value types used in settings.dat registry hive
# used to store AppContainer settings in Windows Apps aka UWP.
#
# ApplicationDataCompositeValue class is documented here:
# https://docs.microsoft.com/en-us/uwp/api/windows.storage.applicationdatacompositevalue
#
# The int... | {
"repo_name": "williballenthin/python-registry",
"path": "Registry/SettingsParse.py",
"copies": "1",
"size": "8334",
"license": "apache-2.0",
"hash": 5793230906230987000,
"line_mean": 48.3136094675,
"line_max": 291,
"alpha_frac": 0.6823854092,
"autogenerated": false,
"ratio": 3.1736481340441736,
... |
#! /bin/python
'''
This is a gearman worker that resolves (latitude, longitude)
tuples to locations using the geodis library.
See usage in main function for more.
'''
import sys
import redis
import os
import traceback
import re
import signal
from gearman_geodis.GeodisWorker import BasicGeodisWorker
def main(argv=sys... | {
"repo_name": "shazamengineering/gearman-geodis",
"path": "gearman_geodis/stdin_geodis_worker.py",
"copies": "1",
"size": "1399",
"license": "apache-2.0",
"hash": 5422225836617714000,
"line_mean": 19.5735294118,
"line_max": 70,
"alpha_frac": 0.6711937098,
"autogenerated": false,
"ratio": 2.908523... |
#!/bin/python
# This is all taken straight from the github.com/google/deepdream github
# repository IPython notebook file.
from cStringIO import StringIO
import numpy as np
import scipy.ndimage as nd
import scipy.misc
import PIL.Image
from IPython.display import clear_output, Image, display
from google.protobuf impor... | {
"repo_name": "magsol/dockerfiles",
"path": "caffe/deepdream.py",
"copies": "2",
"size": "4084",
"license": "apache-2.0",
"hash": 715181412789489200,
"line_mean": 34.8245614035,
"line_max": 93,
"alpha_frac": 0.6415279138,
"autogenerated": false,
"ratio": 3.127105666156202,
"config_test": false,... |
#!/bin/python
# This is an example app which post a shortcode and the desination url the redirect
#
# The intention is to gerenate personal short code URLs allowing analytics
# of the clicks, do to which user received them on for what product and which
# day of the week it was sent, and which position in the message... | {
"repo_name": "sorenriise/node-redirect",
"path": "example.py",
"copies": "1",
"size": "1937",
"license": "mit",
"hash": 4499821708196081000,
"line_mean": 35.5471698113,
"line_max": 165,
"alpha_frac": 0.6551368095,
"autogenerated": false,
"ratio": 3.725,
"config_test": false,
"has_no_keywords... |
#!/bin/python
# this is a prototype of the web forwarding sofware.
import sys
import socket
import threading
import time
import select
import binascii
import struct
#CAMERA_HOST='192.168.1.15'
#CAMERA_PORT=2179
CAMERA_HOST='192.168.2.239'
CAMERA_PORT=81
WEBSERVICE_HOST='192.168.3.2'
#WEBSERVICE_HOST='54-214-172-202... | {
"repo_name": "tongfa/vent",
"path": "tenvisd/main.py",
"copies": "1",
"size": "7026",
"license": "mit",
"hash": -5371654961713480000,
"line_mean": 35.0307692308,
"line_max": 92,
"alpha_frac": 0.5469684031,
"autogenerated": false,
"ratio": 3.9538548114800225,
"config_test": false,
"has_no_key... |
#!/bin/python
# this is built for python 3
# deal with it
import argparse
import sys
import re
# enable debug output
DEBUG = True
# terminal escape sequences
term_esc = re.compile("\x1b\[[0-9;]*m")
class Block:
"""
:class: Represent a single block that will be appended at the end of a row
:attribute da... | {
"repo_name": "qwattash/config",
"path": "old/shell/common/gen_screen.py",
"copies": "1",
"size": "14969",
"license": "mit",
"hash": -5025251575529480000,
"line_mean": 31.9713656388,
"line_max": 126,
"alpha_frac": 0.5405838733,
"autogenerated": false,
"ratio": 4.431320307874482,
"config_test": ... |
#!/bin/python
# This script documents converting Yu's 'final_3.tsv' to 'data.tsv' intended to be imported into
# the whatisit application as sample data
import os
import pandas
input_file = 'final_3.csv'
if os.path.exists(input_file):
raw = pandas.read_csv(input_file)
data = pandas.DataFrame(columns=['repor... | {
"repo_name": "radinformatics/whatisit",
"path": "scripts/prep_data.py",
"copies": "1",
"size": "1099",
"license": "mit",
"hash": 6701267151640113000,
"line_mean": 35.6333333333,
"line_max": 96,
"alpha_frac": 0.5705186533,
"autogenerated": false,
"ratio": 3.738095238095238,
"config_test": false... |
#!/bin/python
""" This script will initialize the local system, sets up the directory
structure, creates master-repo, solutions-repo and directory containing
all the students repo. The students repo will be initialized by adding a
welcome message and also setting up git upstream url
input : List of students ids, B... | {
"repo_name": "avinassh/itworkshop-scripts",
"path": "init.py",
"copies": "1",
"size": "2580",
"license": "mit",
"hash": -1946572494888616200,
"line_mean": 23.3490566038,
"line_max": 141,
"alpha_frac": 0.6434108527,
"autogenerated": false,
"ratio": 3.5149863760217985,
"config_test": false,
"h... |
#! /bin/python
# To understand how templating is done with Tornado. You can specify a folder
# where all templates/html files are store and ask tornado do render them
#
#
# os.path library is used to specify where to look for templates
import os.path
# bunch of tornado imports
import tornado.httpserver
import torna... | {
"repo_name": "avinassh/learning-tornado",
"path": "tornado-book/template_basics/poem_maker/poemmaker.py",
"copies": "1",
"size": "3929",
"license": "mit",
"hash": -6372705671008258000,
"line_mean": 35.0550458716,
"line_max": 78,
"alpha_frac": 0.6989055739,
"autogenerated": false,
"ratio": 3.7312... |
#!/bin/python
'''
This script creates a database in "../data/" folder named data_complete.db in sqlite
The database includes two tables 'positives' and 'negatives'
Each table includes sequence, reads in bg and bins 1 to 4 and ss (secondary structure)
The script can be executed with "python database.py" without argu... | {
"repo_name": "aerijman/Transcriptional-Activation-Domains",
"path": "summary/libraries/database.py",
"copies": "1",
"size": "4536",
"license": "mit",
"hash": -691642976249658000,
"line_mean": 30.7272727273,
"line_max": 120,
"alpha_frac": 0.6644620811,
"autogenerated": false,
"ratio": 3.165387299... |
#!/bin/python
#ui mail
email_addresses = {'crc_admins':['boswald@uidaho.edu'],'all':["dnew@uidaho.edu","boswald@uidaho.edu","alida@uidaho.edu"],'admins':["boswald@uidaho.edu"],'test':["boswald@uidaho.edu"]}
smtp_server = 'm.outlook.com'
smtp_port = 587
# Now construct the message
import smtplib, email
from email.mi... | {
"repo_name": "ibest/GRC_Scripts",
"path": "MiSeq_Pipeline/send_email.py",
"copies": "1",
"size": "2164",
"license": "artistic-2.0",
"hash": -7165973088225388000,
"line_mean": 34.4754098361,
"line_max": 183,
"alpha_frac": 0.6395563771,
"autogenerated": false,
"ratio": 3.52442996742671,
"config_... |
#!/bin/python
#
# UnlmtdCalc Cinema Film Calculator
# This application takes the value of a Cineworld Unlimited Card and works out depending on what ticket tier you choose:
# _ _ _ _ _ ____ _
# | | | |_ __ | |_ __ ___ | |_ __| |/ ___|__ _| | ___
# | | | |... | {
"repo_name": "ZephrFish/UnlmtdCalc",
"path": "UnlmtdCalc_0.01.py",
"copies": "1",
"size": "2590",
"license": "mit",
"hash": -5230224204075162000,
"line_mean": 35.4788732394,
"line_max": 161,
"alpha_frac": 0.5486486486,
"autogenerated": false,
"ratio": 2.9465301478953356,
"config_test": false,
... |
#!/bin/python
# usage:
#
# sheeva-soak
#
# Working directory should be ohwidget,
import sys
import os
import subprocess
import datetime
import time
import shutil
import glob
description = "Run soak tests. ohWidget-specific."
# Hide this from "go help" for now:
command_hidden = True
REQUIRED_DIRS = ["build", "i... | {
"repo_name": "broonie89/loadify-1",
"path": "lib/ohdevtools/commands/sheeva-soak.py",
"copies": "1",
"size": "2178",
"license": "mit",
"hash": 3143792996070029000,
"line_mean": 31.0294117647,
"line_max": 125,
"alpha_frac": 0.6212121212,
"autogenerated": false,
"ratio": 3.4571428571428573,
"con... |
#!bin/python
# Uses https://github.com/cmcqueen/simplerandom
from babydes import babydes_enc, babydes_dec, random, create_key
from base64 import b64encode
import os
# Test BabyDES
#text = os.urandom(32)
#key = os.urandom(32)
#ciphertext = babydes_enc(random, len(text), key, text)
#print base64.b64encode(ciphertext)
#... | {
"repo_name": "llewelld/birthdayparadox",
"path": "yeahbaby.py",
"copies": "1",
"size": "1099",
"license": "mit",
"hash": 1590089698888117000,
"line_mean": 34.4516129032,
"line_max": 117,
"alpha_frac": 0.7242948135,
"autogenerated": false,
"ratio": 3.0359116022099446,
"config_test": false,
"h... |
#!bin/python
# Uses https://github.com/cmcqueen/simplerandom
import simplerandom.iterators as srr
import binascii
from base64 import b64encode
import math
import struct
# BabyDES encrypt
# Variable length Feistel cipher
# Only as secure as the PRF you give it
def babydes_enc(prf, width, key, cleartext):
assert width... | {
"repo_name": "llewelld/birthdayparadox",
"path": "babydes.py",
"copies": "1",
"size": "2621",
"license": "mit",
"hash": 3491267195783259600,
"line_mean": 26.8829787234,
"line_max": 116,
"alpha_frac": 0.685616177,
"autogenerated": false,
"ratio": 2.9716553287981857,
"config_test": false,
"has... |
#!/bin/python
#!/usr/bin/env python
import numpy as np
import time
import matplotlib
matplotlib.use('TKagg')
from matplotlib import pyplot as plt
def randomwalk(dims=(256, 256), n=20, sigma=5, alpha=0.95, seed=1):
""" A simple random walk with memory """
r, c = dims
gen = np.random.RandomState(seed)
... | {
"repo_name": "k323r/flugkatze",
"path": "cockpit/python/live_blit.py",
"copies": "1",
"size": "1899",
"license": "mit",
"hash": -5170248956151376000,
"line_mean": 21.8795180723,
"line_max": 76,
"alpha_frac": 0.5313322801,
"autogenerated": false,
"ratio": 3.2350936967632027,
"config_test": fals... |
#!/bin/python
__version__ = 'v1.1.0'
import argparse
import requests
import timetable
import datetime
import time
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--day', default='', required=False, help="Day to check the timetable on. (eg: Thursday)")
parser.add_argument(... | {
"repo_name": "egeldenhuys/emptiness",
"path": "emptiness.py",
"copies": "1",
"size": "1160",
"license": "mit",
"hash": -8713501238492307000,
"line_mean": 27.2926829268,
"line_max": 118,
"alpha_frac": 0.7137931034,
"autogenerated": false,
"ratio": 3.1266846361185983,
"config_test": false,
"ha... |
#!/bin/python
# wiring info (BCM pins)
POWER_BTN = 26 # hi = on
AP_SWITCH = 5 # hi = access point
STATUS_LED = 6 # hi = on
import RPi.GPIO as GPIO
import time
import os
# use the broadcom pin numbers instead of physical pin numbers
GPIO.setmode(GPIO.BCM)
def shutdown(channel):
os.system("sudo shutdown -h now")
... | {
"repo_name": "codeforbirmingham/smarterbham",
"path": "citysensor/scripts/control.py",
"copies": "1",
"size": "1262",
"license": "mit",
"hash": 464637171532688960,
"line_mean": 23.2692307692,
"line_max": 86,
"alpha_frac": 0.6671949287,
"autogenerated": false,
"ratio": 3.0855745721271393,
"conf... |
#!/bin/python
# One script to rule them and in the darkness troll them.
import madbot
import tweepy
import tweet_scraper
from credz import consumer_key, consumer_secret, access_token, access_token_secret
# --- get set up with the twitters --- #
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access... | {
"repo_name": "corcra/troll-interconnector",
"path": "bot.py",
"copies": "1",
"size": "1097",
"license": "mit",
"hash": 8685800474875357000,
"line_mean": 26.425,
"line_max": 82,
"alpha_frac": 0.7237921604,
"autogenerated": false,
"ratio": 3.2170087976539588,
"config_test": false,
"has_no_keyw... |
#!/bin/python
# path to python
# where is your writable directory? Jobs will be managed in a .queue directory here.
SCRATCH="FULL_PATH_TO_YOUR_SCRATCH_SPACE"
# username
USER="YOUR_USERNAME_HERE"
# how big is one batch of jobs? ex 10 means there must be 10 free slots to run another batch.
JOB_ARRAY_MAX=20
# max tota... | {
"repo_name": "JorySchossau/hpcc_tools",
"path": "queue.py",
"copies": "1",
"size": "9420",
"license": "mit",
"hash": -6702409757072599000,
"line_mean": 38.25,
"line_max": 288,
"alpha_frac": 0.694373673,
"autogenerated": false,
"ratio": 2.9904761904761905,
"config_test": false,
"has_no_keywor... |
#!/bin/python
'''plotr'''
import sys
import re
from collections import namedtuple
Point = namedtuple('Point', ('x', 'y'))
class Pointr(object):
def __init__(self, digits=None):
self.digits = digits
def parse(self, instr):
d_match = re.match(instr, r'(\d+)')
if d_match:
s... | {
"repo_name": "ssangervasi/dev-tools",
"path": "scripts/plotr.py",
"copies": "1",
"size": "1688",
"license": "mit",
"hash": -9206041075079934000,
"line_mean": 24.9692307692,
"line_max": 63,
"alpha_frac": 0.4603080569,
"autogenerated": false,
"ratio": 3.2213740458015265,
"config_test": false,
... |
#!/bin/python
# Process a file's `...` instructions using an mmfile's typographical commands
# Reads from stdin and sends to stdout. By default the mmfile is "set.mm".
# Use the "--help" option to see all the options.
# Sample usage:
# python scripts/typeset.py --html < demo.html.raw > demo.html
# Copyright 2018, Dav... | {
"repo_name": "metamath/set.mm",
"path": "scripts/typeset.py",
"copies": "1",
"size": "6081",
"license": "cc0-1.0",
"hash": -1502300282168786200,
"line_mean": 32.0489130435,
"line_max": 78,
"alpha_frac": 0.64791975,
"autogenerated": false,
"ratio": 3.793512164691204,
"config_test": false,
"ha... |
#/bin/python
# Program for fuzzing arbitrary tcp servers //with connector applied to an ftp server
import socket
import sys
import signal
TARGET_SERVER = ("127.0.0.1", 8888)
ftp_login_user = 'test'
ftp_login_pass = 'test'
tcpSocket = 0
def signal_handler(signum, frm) :
global tcpSocket
print "SIGINT received"
... | {
"repo_name": "ahhh/SPSE",
"path": "ftp_command_fuzzer.py",
"copies": "1",
"size": "1718",
"license": "mit",
"hash": -7740566376349768000,
"line_mean": 24.6417910448,
"line_max": 85,
"alpha_frac": 0.6897555297,
"autogenerated": false,
"ratio": 3.3818897637795278,
"config_test": false,
"has_no... |
#/bin/python
# Program for fuzzing / attacking an ftp PASS field
import socket
import sys
import signal
TARGET_SERVER = ("127.0.0.1", 8888)
ftp_login_user = 'test'
ftp_login_pass = 'test'
tcpSocket = 0
def signal_handler(signum, frm) :
global tcpSocket
print "SIGINT received"
print "Shutting down client gracef... | {
"repo_name": "ahhh/SPSE",
"path": "ftp_signals_login_brute.py",
"copies": "1",
"size": "1259",
"license": "mit",
"hash": 3808669783272720400,
"line_mean": 21.8909090909,
"line_max": 78,
"alpha_frac": 0.6791104051,
"autogenerated": false,
"ratio": 3.1712846347607053,
"config_test": false,
"ha... |
#/bin/python
# Program for getting stats out of the Alexa_10000_domains.txt (top alexa domains)
# Example: python mechanize_scraper.py -t Alexa_10000_domains.txt -s robots_directory -p robots.txt -n 10
import mechanize
import logging
import time
from optparse import OptionParser
from urllib2 import HTTPError
import Qu... | {
"repo_name": "thedarkcoder/SPSE",
"path": "mechanize_scraper_threaded.py",
"copies": "2",
"size": "3936",
"license": "mit",
"hash": -535442188521902200,
"line_mean": 29.9921259843,
"line_max": 105,
"alpha_frac": 0.6158536585,
"autogenerated": false,
"ratio": 3.7237464522232733,
"config_test": ... |
#/bin/python
# Program for messing w/ arp spoofing in python w/ scapy
# Remeber to enable ip forwarding with: "echo 1 > /proc/sys/ipv4/ip_forward"
import threading
import time
import sys
from scapy.all import *
from scapy import *
VICTIM_IP = '192.168.1.2' # Target man in the middle victim
VICTIM_MAC = ''
GATEWAY_I... | {
"repo_name": "ahhh/SPSE",
"path": "arp_spoof.py",
"copies": "2",
"size": "2118",
"license": "mit",
"hash": 7118669579618487000,
"line_mean": 22.797752809,
"line_max": 76,
"alpha_frac": 0.6855524079,
"autogenerated": false,
"ratio": 2.8816326530612244,
"config_test": false,
"has_no_keywords":... |
#/bin/python
# Program for messing w/ DNS spoofing
import time
import logging
import os, sys
import fcntl
from optparse import OptionParser
from scapy.all import *
continue_threads = True
dns_filter = "udp port 53"
class DNS_Spoof():
def __init__(self, opts):
self.interface = opts.interface
self.redirect = opts.... | {
"repo_name": "thedarkcoder/SPSE",
"path": "dns_spoof.py",
"copies": "2",
"size": "2712",
"license": "mit",
"hash": -3535367808501880300,
"line_mean": 33.7692307692,
"line_max": 241,
"alpha_frac": 0.6301622419,
"autogenerated": false,
"ratio": 3.4416243654822334,
"config_test": false,
"has_no... |
#! /bin/python
# Program for messing with tcp server and signals
import sys, signal, socket, random
# set our socket as a global variable
s = 0
def signal_handler(signum, frm) :
global s
print "SIGINT received"
print "Shutting down listener gracefully."
# now shut it down
s.close()
print "Exiting now."... | {
"repo_name": "thedarkcoder/SPSE",
"path": "tcpServer_signals.py",
"copies": "2",
"size": "1124",
"license": "mit",
"hash": 4808516595804638000,
"line_mean": 21.9387755102,
"line_max": 57,
"alpha_frac": 0.6761565836,
"autogenerated": false,
"ratio": 3.4164133738601823,
"config_test": false,
"... |
#/bin/python
# Program for messing with web driver
from selenium import webdriver
import logging
from optparse import OptionParser
from urlparse import urlparse
def screen_cap(site, output):
driver = webdriver.Firefox()
driver.set_window_size(1024,480)
driver.get(site)
driver.save_screenshot(output)
driver.... | {
"repo_name": "ahhh/SPSE",
"path": "selenium_webdriver.py",
"copies": "2",
"size": "1670",
"license": "mit",
"hash": -4385853285124554000,
"line_mean": 28.8214285714,
"line_max": 66,
"alpha_frac": 0.625748503,
"autogenerated": false,
"ratio": 3.856812933025404,
"config_test": false,
"has_no_k... |
#/bin/python
# Program for messing w/ threaded scanning
import threading
import Queue
import time
from scapy.all import *
class WorkerThread(threading.Thread):
def __init__(self, queue, tid, target, source):
threading.Thread.__init__(self)
self.queue = queue
self.tid = tid
self.target = target
... | {
"repo_name": "ahhh/SPSE",
"path": "xmasScan_threaded.py",
"copies": "2",
"size": "2173",
"license": "mit",
"hash": 3490105924798838300,
"line_mean": 32.953125,
"line_max": 158,
"alpha_frac": 0.6304647952,
"autogenerated": false,
"ratio": 3.4274447949526814,
"config_test": false,
"has_no_keyw... |
#/bin/python
# Program for messing w/ threaded scanning
import threading
import Queue
import time
from scapy.all import *
SOURCE_IP = "127.0.0.1"
TARGET_IP = "127.0.0.1"
class WorkerThread(threading.Thread):
def __init__(self, queue, tid):
threading.Thread.__init__(self)
self.queue = queue
self.tid = ... | {
"repo_name": "thedarkcoder/SPSE",
"path": "synScan_threaded.py",
"copies": "2",
"size": "1351",
"license": "mit",
"hash": -4451760026321918500,
"line_mean": 21.8983050847,
"line_max": 101,
"alpha_frac": 0.6113989637,
"autogenerated": false,
"ratio": 3.263285024154589,
"config_test": false,
"... |
#/bin/python
# Program for messing w/ threads and options
import threading
import Queue
import time
import logging
from optparse import OptionParser
continue_threads = True
class WorkerThread(threading.Thread):
def __init__(self, queue):
threading.Thread.__init__(self)
self.queue = queue
def finish(se... | {
"repo_name": "thedarkcoder/SPSE",
"path": "threads2.py",
"copies": "2",
"size": "2215",
"license": "mit",
"hash": 7117769795432393000,
"line_mean": 24.1704545455,
"line_max": 66,
"alpha_frac": 0.6167042889,
"autogenerated": false,
"ratio": 3.920353982300885,
"config_test": false,
"has_no_key... |
#!/bin/python
# Python3 script which continuously reads Gmail messages and uploads them to GitHub
#
# This script assumes there exists a credentials directory (which is .gitignored) containing:
# - oauth secret api key
# - stored oauth access token for the gmail account
# - GitHub personal access token
#
# This also re... | {
"repo_name": "wko27/blog",
"path": "scripts/comment.py",
"copies": "1",
"size": "8525",
"license": "mit",
"hash": -1585543075758363000,
"line_mean": 37.3918918919,
"line_max": 154,
"alpha_frac": 0.6299425085,
"autogenerated": false,
"ratio": 3.8953382084095063,
"config_test": false,
"has_no_... |
# This is a rough translation; must sometimes hand-fix results.
# E.g., replace this:
# <IMG SRC='_ltbbr.gif' WIDTH=20 HEIGHT=19 ALT=' <RR' TITLE='<RR'>
# with this:
# ` <RR `
# Here's a simple test:
# python scripts/unjunk.py < mmcomplex.html > ,unjunked
# python scripts/typeset.py --html < ,unjunked > ,rejun... | {
"repo_name": "metamath/set.mm",
"path": "scripts/unjunk.py",
"copies": "1",
"size": "2202",
"license": "cc0-1.0",
"hash": 4937622321774762000,
"line_mean": 31.8656716418,
"line_max": 75,
"alpha_frac": 0.6453224342,
"autogenerated": false,
"ratio": 3.110169491525424,
"config_test": false,
"ha... |
#!/bin/python
# Resize an image and split it to be used as wallpapers on adjacent desktop (for use with synergy KM switch for example)
from optparse import OptionParser
from PIL import Image
import os
import random
from decimal import Decimal
import glob
import ast
import itertools
from collections import namedtuple
... | {
"repo_name": "esabouraud/mmwall",
"path": "src/synergy_wallpaper.py",
"copies": "1",
"size": "5005",
"license": "bsd-3-clause",
"hash": 2351745827675760000,
"line_mean": 34.75,
"line_max": 231,
"alpha_frac": 0.7182817183,
"autogenerated": false,
"ratio": 3.044403892944039,
"config_test": false... |
#!/bin/python
# Roughly this is about visualising a probability distribution over a 2D space.
# It's not random.
# The PDF is given by a mixture of 2D gaussians with:
# (for each component of the mixture)
# a uniform prior (between -1 and +1) over means
# a uniform prior over the *scale* of the covariance matrix, given... | {
"repo_name": "corcra/pioton",
"path": "multinorm_mixture.py",
"copies": "1",
"size": "2219",
"license": "mit",
"hash": -2638451692767832600,
"line_mean": 28.1973684211,
"line_max": 92,
"alpha_frac": 0.6665164489,
"autogenerated": false,
"ratio": 2.9274406332453826,
"config_test": false,
"has... |
#!/bin/python
# Script for Chess matrix exploration using Knight piece moves (L) and determining the best combination.
import sys
n = int(raw_input().strip())
for i in range(1, n) :
if i>1 :
print
for j in range(1, n) :
notreached = True
nonew = True
oldset = [(n - 1, n - 1)]
... | {
"repo_name": "HoussemCharf/FunUtils",
"path": "Fun Scripts/KnightL.py",
"copies": "1",
"size": "2317",
"license": "mit",
"hash": 2474573842103600000,
"line_mean": 44.431372549,
"line_max": 115,
"alpha_frac": 0.4238239102,
"autogenerated": false,
"ratio": 3.4073529411764705,
"config_test": fals... |
#!/bin/python
# Script may accept from 0 up to 3 arguments:
# If there are not the arguments then will be printed info about all jobs like: {'running': 55, 'accepted': 115, 'submitted': 0}
# If there is one argument (can be one of running, accepted, submitted) then will be printed info about quantity of kind jobs (runn... | {
"repo_name": "arshvin/scripts",
"path": "zabbix/T_spark_job_count/CountJobs.py",
"copies": "1",
"size": "3252",
"license": "apache-2.0",
"hash": 8592505713366082000,
"line_mean": 31.52,
"line_max": 182,
"alpha_frac": 0.6706642066,
"autogenerated": false,
"ratio": 3.132947976878613,
"config_tes... |
#!/bin/python
# see https://wiki.archlinux.org/index.php/simple_stateful_firewall
import iptc
def allowFwd(anIP):
# allows all forwarding to/by a client on the network
# iptables -A FORWARD -s $IP_CLIENT -j ACCEPT
chain = iptc.Chain(iptc.Table(iptc.Table.FILTER), "FORWARD")
rule = iptc.Rule()
rule.src = anIP+"/255... | {
"repo_name": "samnet/bybit",
"path": "uml/hpUtils.py",
"copies": "1",
"size": "2298",
"license": "mit",
"hash": 7656214922713754000,
"line_mean": 26.0352941176,
"line_max": 80,
"alpha_frac": 0.682767624,
"autogenerated": false,
"ratio": 2.8058608058608057,
"config_test": false,
"has_no_keywo... |
#!/bin/python
"""Sets the squelch level."""
import subprocess
import threading
import time
import io
def bytes_at_squelch_level(squelch_level):
"""Returns the number of bytes received at a squelch level."""
# Python 3
if hasattr(subprocess, 'DEVNULL'):
devnull = subprocess.DEVNULL
else:
... | {
"repo_name": "bskari/eclipse-2017-hab",
"path": "rtl-sdr/set-squelch.py",
"copies": "1",
"size": "2104",
"license": "mit",
"hash": -1672839682732668700,
"line_mean": 23.4651162791,
"line_max": 80,
"alpha_frac": 0.5437262357,
"autogenerated": false,
"ratio": 3.5125208681135227,
"config_test": f... |
#!/bin/python
# Solution for https://www.hackerrank.com/challenges/almost-sorted
n = int(raw_input().strip())
values = [int(s) for s in raw_input().strip().split(' ')]
ascending = 1
descending = 2
def is_ascending_or_descending(data, direction):
if len(data) <= 1:
return True
item = data[0]
for i ... | {
"repo_name": "ernestoalarcon/competitiveprogramming",
"path": "almost-sorted.py",
"copies": "1",
"size": "1773",
"license": "mit",
"hash": -5423874588764149000,
"line_mean": 30.6785714286,
"line_max": 90,
"alpha_frac": 0.510998308,
"autogenerated": false,
"ratio": 3.3016759776536313,
"config_t... |
#!/bin/python
# split train and development data
import numpy
import os
os.environ['GLOG_minloglevel'] = '2'
import sys
import caffe
import cPickle
import THORUtils as utils
import THORConfig as config
from THOROfflineEnv import ImageDB
from THOROfflineEnv import FeatureDB
feature_layer_name = 'pool5'
def extract_im... | {
"repo_name": "YuMao1993/DRL",
"path": "THOR/script_extract_resnet_feature.py",
"copies": "1",
"size": "3128",
"license": "mit",
"hash": 7806170348680183000,
"line_mean": 40.1578947368,
"line_max": 97,
"alpha_frac": 0.6291560102,
"autogenerated": false,
"ratio": 3.456353591160221,
"config_test"... |
#!/bin/python
# SRAFixer.py
# by Brendan Kohrn, January 15, 2015
#
# This program is meant to refomat reads downladed from the SRA
# (http://www.ncbi.nlm.nih.gov/sra/), including the example data set
# (http://trace.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?run=SRR1613972).
# It is necessary because when the reads are do... | {
"repo_name": "mwschmit/Duplex-Sequencing",
"path": "TestData/SRAFixer.py",
"copies": "2",
"size": "1764",
"license": "bsd-3-clause",
"hash": -7896407896374447000,
"line_mean": 32.2830188679,
"line_max": 71,
"alpha_frac": 0.6439909297,
"autogenerated": false,
"ratio": 3.073170731707317,
"config... |
#!/bin/python
# The purpose of this script is to take the *machine-readable* output of UMLS
# MetaMap and convert it to something that looks like a sentence of UMLS CUIs,
# if possible. Ideally there would be an option in MetaMap to do this, assuming
# it is sensible.
import re
import sys
#INTERACTIVE = True
INTERA... | {
"repo_name": "corcra/UMLS",
"path": "parse_metamap.py",
"copies": "1",
"size": "8989",
"license": "mit",
"hash": -6594598836816465000,
"line_mean": 38.4254385965,
"line_max": 115,
"alpha_frac": 0.6007342307,
"autogenerated": false,
"ratio": 3.7658148303309593,
"config_test": false,
"has_no_k... |
#!/bin/python
# This demo shows off using a web server and flash to upload and image
# and then do image processing in the cloud with SimpleCV then pass
# it back to the web browser via AJAX
#
# Using jpegcam as flash webcam library:
# http://code.google.com/p/jpegcam/
from __future__ import print_function
import os, t... | {
"repo_name": "tpltnt/SimpleCV",
"path": "SimpleCV/examples/web-based/cloudanimator/cloudanimator.py",
"copies": "1",
"size": "3173",
"license": "bsd-3-clause",
"hash": -1217538978072178000,
"line_mean": 32.4,
"line_max": 138,
"alpha_frac": 0.5906082572,
"autogenerated": false,
"ratio": 4.1315104... |
class Progress(object):
"""
An interface to things that track the progress of a long running task.
"""
def __init__(self, max_):
super(Progress, self).__init__()
self._max = max_
self._current = 0
def set_current(self, current):
"""
Set the number of steps ... | {
"repo_name": "williballenthin/INDXParse",
"path": "Progress.py",
"copies": "4",
"size": "2290",
"license": "apache-2.0",
"hash": -3021198098775786500,
"line_mean": 29.1315789474,
"line_max": 76,
"alpha_frac": 0.6131004367,
"autogenerated": false,
"ratio": 4.074733096085409,
"config_test": fals... |
import mmap
import contextlib
import argparse
from Evtx.Evtx import FileHeader
from Evtx.Views import evtx_file_xml_view
from Evtx.Nodes import RootNode
from Evtx.Nodes import BXmlTypeNode
from Evtx.Nodes import AttributeNode
from Evtx.Nodes import VariantTypeNode
from Evtx.Nodes import TemplateInstanceNode
from Evtx... | {
"repo_name": "ohio813/python-evtx",
"path": "scripts/evtx_structure.py",
"copies": "1",
"size": "6926",
"license": "apache-2.0",
"hash": 3365777745022546400,
"line_mean": 34.1573604061,
"line_max": 111,
"alpha_frac": 0.5516892867,
"autogenerated": false,
"ratio": 3.906373378454597,
"config_tes... |
import mmap
import contextlib
import argparse
from Evtx.Evtx import FileHeader
from Evtx.Views import evtx_file_xml_view
def main():
parser = argparse.ArgumentParser(
description="Dump a binary EVTX file into XML.")
parser.add_argument("--cleanup", action="store_true",
help="... | {
"repo_name": "ohio813/python-evtx",
"path": "scripts/evtxdump.py",
"copies": "1",
"size": "1756",
"license": "apache-2.0",
"hash": 4775949798980023000,
"line_mean": 34.8367346939,
"line_max": 82,
"alpha_frac": 0.6275626424,
"autogenerated": false,
"ratio": 3.8008658008658007,
"config_test": fa... |
import sys
import binascii
import mmap
import contextlib
from Evtx.Evtx import FileHeader
def main():
with open(sys.argv[1], 'r') as f:
with contextlib.closing(mmap.mmap(f.fileno(), 0,
access=mmap.ACCESS_READ)) as buf:
fh = FileHeader(buf, 0x0)
... | {
"repo_name": "ohio813/python-evtx",
"path": "scripts/evtxinfo.py",
"copies": "1",
"size": "4456",
"license": "apache-2.0",
"hash": 8267577911880387000,
"line_mean": 39.5090909091,
"line_max": 85,
"alpha_frac": 0.4768850987,
"autogenerated": false,
"ratio": 4.1528424976700835,
"config_test": fa... |
import mmap
import sys
import contextlib
import argparse
from Evtx.Evtx import FileHeader
def main():
parser = argparse.ArgumentParser(
description="Dump the slack space of an EVTX file.")
parser.add_argument("evtx", type=str,
help="Path to the Windows EVTX event log file")
... | {
"repo_name": "ohio813/python-evtx",
"path": "scripts/dump_chunk_slack.py",
"copies": "1",
"size": "1693",
"license": "apache-2.0",
"hash": 8653821438358845000,
"line_mean": 35.0212765957,
"line_max": 82,
"alpha_frac": 0.6343768458,
"autogenerated": false,
"ratio": 3.9189814814814814,
"config_t... |
#!/bin/python
# This is a simple .py script to preprocess a csv of projects.
# The script assumes that a CSV file exists with at least
# repository_name, repository_url, repository_language fields.
#
# Originally, this CSV files have been created by the following
# Google BigQuery ( https://bigquery.cloud.google.com/ )... | {
"repo_name": "mast-group/commitmining-tools",
"path": "src/main/java/committools/repositoryDownloader/preprocess.py",
"copies": "1",
"size": "4348",
"license": "bsd-3-clause",
"hash": 2432670690757587000,
"line_mean": 32.1908396947,
"line_max": 102,
"alpha_frac": 0.7049218031,
"autogenerated": fal... |
#!../../../bin/python
"""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.uic import compileUi as pyqt4_compileUi
pyqt4_compiler = pyqt4_compileUi
except ImportError:
pyqt4_comp... | {
"repo_name": "eoyilmaz/anima",
"path": "anima/ui/uiCompiler.py",
"copies": "1",
"size": "7561",
"license": "mit",
"hash": -4411372523788322300,
"line_mean": 27.4248120301,
"line_max": 79,
"alpha_frac": 0.5583917471,
"autogenerated": false,
"ratio": 3.661501210653753,
"config_test": false,
"h... |
#!/bin/python
# This script is intended to be used with WordFish http://www.github.com/radinformatics/whatisit
# This script will upload the data for the US APPENDIX reports, including basic reports and ids. The labels are not included, they will be derived in the web interface.
# AllowedAnnotation objects store a lab... | {
"repo_name": "radinformatics/usappendix",
"path": "prep/upload_appendix.py",
"copies": "1",
"size": "1963",
"license": "mit",
"hash": -9003338147623561000,
"line_mean": 37.4901960784,
"line_max": 168,
"alpha_frac": 0.6418746816,
"autogenerated": false,
"ratio": 3.856581532416503,
"config_test"... |
#!/bin/python
# This script will upload a file prvided as a second argument to an object
# store bucket whose name is provided as the first argument.
#
# Usage: python uplaod_cm_to_S3.py <bucket name> <file name> [<cloud alias>]
#
# If used with AWS EC2, the script requires `~/.boto` file to contain your
# AWS keys, as... | {
"repo_name": "afgane/CloudMan-update-scripts",
"path": "upload_cm_to_S3.py",
"copies": "1",
"size": "3270",
"license": "mit",
"hash": -2605683188528936400,
"line_mean": 34.5434782609,
"line_max": 102,
"alpha_frac": 0.628440367,
"autogenerated": false,
"ratio": 3.231225296442688,
"config_test":... |
#!/bin/python
# This script will upload the data for dockerfiles, for use with the tagging view
import os
import re
import pandas
import pickle
import numpy
from whatisit.settings import BASE_DIR
from django.contrib.auth.models import User
from whatisit.apps.tagtrout.models import (
DocsCollection,
Doc
)
in... | {
"repo_name": "radinformatics/whatisit",
"path": "scripts/upload_docs.py",
"copies": "1",
"size": "1393",
"license": "mit",
"hash": -8071075550064801000,
"line_mean": 32.1666666667,
"line_max": 109,
"alpha_frac": 0.6037329505,
"autogenerated": false,
"ratio": 3.9461756373937678,
"config_test": ... |
#!/bin/python
# This script will upload the data from @mlungren's project, including basic reports and labels
# (see README.md for full instructions). In the long run we want a standard data format for importing.
# AllowedAnnotation objects store a label name and allowed value, and an Annotation combines one of these ... | {
"repo_name": "radinformatics/whatisit",
"path": "scripts/upload_demo.py",
"copies": "1",
"size": "5956",
"license": "mit",
"hash": -1126892336741157100,
"line_mean": 46.2698412698,
"line_max": 145,
"alpha_frac": 0.6145063801,
"autogenerated": false,
"ratio": 4.144745998608212,
"config_test": f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.