content stringlengths 7 1.05M |
|---|
#daemon = True
# 1 core should equal 2*1+1=3 workers
workers = 3
# we want to use threads for concurrency. we estimate that a maximum of 3*7=21 users will use the application simultaneously
worker_class = "gthread"
threads = 7
#accesslog = "logs/access.log"
#errorlog = "logs/error.log"
|
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the ... |
#! /usr/bin/env python
# Copyright Lajos Katona
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
#!/usr/bin/env python
"""
Container class for parameters that are used to create a movie tile
"""
__author__ = 'Michal Frystacky'
class Movie:
"""
Container for extracted movie information data
"""
def __init__(self, title, poster_image_url, youtube_url, summary, director, *stars):
"""
... |
"""A rule for building projects using the [GNU Make](https://www.gnu.org/software/make/) build tool"""
load(
"//foreign_cc/private:cc_toolchain_util.bzl",
"get_flags_info",
"get_tools_info",
)
load(
"//foreign_cc/private:detect_root.bzl",
"detect_root",
)
load(
"//foreign_cc/private:framework.b... |
# Customer class
class Customer:
def __init__(self, name, address, phone):
self.__name = name
self.__address = address
self.__phone = phone
def set_name(self, name):
self.__name = name
def set_address(self, address):
self.__address = address
def set_phone(self,... |
# %% [695. Max Area of Island](https://leetcode.com/problems/max-area-of-island/)
class Solution:
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
n, m = len(grid), len(grid[0])
u = unionfind(n, m)
for i in range(n):
for j in range(m):
if j + 1 < m and gri... |
# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project au... |
#!/usr/bin/python3
'''This module contains the add_integer function
'''
def add_integer(a, b=98):
'''add_integer adds two integers and/or floats together
and returns an integer of their sum
'''
if not isinstance(a, (int, float)):
raise TypeError("a must be an integer")
if not isinstance(b,... |
class Config(object):
def __init__(self, stellar_sed, laser_sed,
filt, nsamples, sample_rate, pulse_duration):
self.stellar_sed = stellar_sed
self.laser_sed = laser_sed
self.filt = filt
self.nsamples = nsamples # in ns
self.sample_rate = sample_rate # in ... |
# This is a util to create the advancement files
# Advancement list from https://github.com/jan00bl/mcfunction-novum/blob/master/lib/1.16/id/advancement.json
advancements = [
"minecraft:adventure/adventuring_time",
"minecraft:adventure/arbalistic",
"minecraft:adventure/bullseye",
"minecraft:adventure/h... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Membership Management',
'version': '1.0',
'category': 'Sales',
'description': """
This module allows you to manage all operations for managing memberships.
====================================... |
#
# PySNMP MIB module HOTWIRE-MSDSL-INTERFACE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HOTWIRE-MSDSL-INTERFACE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:20:19 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python versio... |
"""
Backwards-compatible import location for the model-based activation
workflow.
Formerly this was the default registration workflow of
django-registration, and so was found at
registration.backends.default. As of the current release, however, it
is no longer the default workflow (there is now no default), and has
ac... |
sql_user = "lopez"
# for obvious reasons this should be changed
sql_pass = "johny johny telling lies"
sql_db = "lopez"
sql_host = "localhost"
sql_port = 5432
# changing the below line will void the non-existent warranty Lopez came with
# so please don't
postgresql = "postgresql://{0}:{1}@{2}:{3}/{4}".format(
sql_us... |
lista = ['Flávio', 'José', 'Pedro']
# print(lista)
for item in range(len(lista)):
# print('Item número', item, 'Contém', lista[item])
print('Item nº {} contém {}'.format(item, lista[item]))
lista = list(range(21))
print(lista) |
DEPS = [
'chromium',
'file',
'gsutil',
'recipe_engine/json',
'math_utils',
'recipe_engine/path',
'recipe_engine/platform',
'recipe_engine/properties',
'recipe_engine/python',
'recipe_engine/raw_io',
'recipe_engine/step',
]
|
# print('\033[0;35;40mOla Mundo\033[m')
# a = 3
# b = 5
# print('Os valores são \033[1;32m{}\033[m e \033[4;035m{}'.format(a,b))
n1 = 1
n2 = 8
cores = {'limpa': '\033[m', 'azul': '\033[7;30;44m', 'amarelo': '\033[0;033m'}
print('Os valores são {}{}{} e {}{}{}'.format(cores['azul'], n1, cores['limpa'], cores['amarelo']... |
class Solution:
def XXX(self, root: TreeNode) -> List[List[int]]:
ans, d = [], [root] if root else []
while d:
ans.append([t.val for t in d])
d = [r for t in d for r in (t.left, t.right) if r]
return ans
|
# Range -> range instance that holds all nums counting by one between 0 and first input
# List -> lists numbers from the inputted tuple
numberedContestants = range(30)
print(list(numberedContestants))
for c in list(numberedContestants):
print(f"Contestant {c} is here.")
lucky_winners = range(7, 30, 5)
print(lis... |
class Thing:
def __init__(self, x, y, name):
self.x = x
self.y = y
self.name = name
t = Thing(12, 34, "dave")
print(vars(t)) # {'x': 12, 'y': 34, 'name': 'dave'}
|
"""
module docstring for pylint
"""
print("Hello")
print("new line to test")
|
#!/usr/bin/python
class FilterModule(object):
def filters(self):
return {
'amend_list_items': self.amend_list_items
}
def amend_list_items(self, orig_list, prefix="", postfix=""):
return list(map(lambda listelement: prefix +
str(listelement) + postfix... |
"""Loads config from several locations."""
def test_multifolder(multifolder_config):
"""Check if files from 2nd folder had been loaded."""
assert 'key_config2' in multifolder_config.registry['config']
|
M=int(input("qual é a massa ?"))
A=int(input("qual é a aceleração ?"))
F= M * A
print("o produto da massa de {}kg vezes a aceleração de {}m/s^2 é igual a força de {} N". format(M, A, F))
|
"""Criar um programa que leia a velocidade de um carro com as sequintes condições
*Se ele ultrapassar 80km/h será multado com R$ 7,00 por km a mais acima do limite
*Caso esteja no limite não será multado"""
speed = float(input("Digite a velocidade do veículo: "))
if speed >= 80:
print('A multa por ultrapassar a v... |
"""a Django app defining markdown processing filters and tags for templates
USAGE
------------
Include this app into your installed apps. Then you can use
code like the one below in your templates
{% load markdown_tags %}
AN EXAMPLE FOR THE USE OF THE MARKDOWNF FILTER<br/>
{{ a_safe_variable_containi... |
#!/usr/bin/env python
def calcPi(limit): # Generator function
"""
Prints out the digits of PI
until it reaches the given limit
"""
q, r, t, k, n, l = 1, 0, 1, 1, 3, 3
decimal = limit
counter = 0
while counter != decimal + 1:
if 4 * q + r - t < n * t:
... |
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
# Function to print the list
def print_list(self):
node = self
output = ''
while node:
output += str(node.val)
output += " "
node = node.next
prin... |
class EmptyFactor:
"""
Empty factors, such as safeZoneX which do not get multiplied by anything
"""
def __str__(self):
return type(self).__name__
def __repr__(self):
return str(self)
def _operation_skip_if(self, skip, other, op):
if other == skip:
return se... |
'''
prompt = "\nTell me something, and i will repeat it back to you."
prompt += "\n'quit' to end the program."
prompt += "\n"
message = ""
active = True
while active:
message = input(prompt)
if message == 'quit':
active = false
else:
print(message)
'''
current_number = 0
while current_n... |
# -*- coding: utf-8 -*-
'''
Cluster Helpers (functions)
Functions that help with clusters.
'''
# This file can be found in our projectfolder in /softpro/ss16/swp-ss16-srk/autosarkasmus/autosarkasmus/baseline/rsrc
CLUSTER_FILE = '../rsrc/lda-topics-10-50.v2'
# Get the number of clusters
def load_number_of_clusters()... |
# Program to calculate Factorial of a Number.
N = int(input("N = "))
def factorial(N):
f = 1
for i in range(1,N+1):
f *= i
print(f)
factorial(N)
|
# Variável int
ano = int(input('Digite o ano: '))
# Variável
anonovo = ano % 4
# Cores
cor = {'fim': '\033[m',
'roxo': '\033[35m',
'branco': '\033[30m'}
# IFS Print
if anonovo == 0:
print(f'{cor["branco"]}Este ano é bissexto {cor["fim"]}')
else:
print(f'{cor["roxo"]}Este ano não é bissexto {cor["f... |
'''
Author : MiKueen
Level : Easy
Problem Statement : Delete Node in a Linked List
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
Given linked list -- head = [4,5,1,9], which looks like following:
Example 1:
Input: head = [4,5,1,9], node = 5
Output: [4,1,9... |
class number:
"""
This product includes software developed by L. Pham-Trong and this guy rocks.
"""
def __init__(self, value: str, base):
alphabet = [str(i) for i in range(10)] + [chr(i).upper() for i in range(97, 123)]
self.val = [c for c in value]
self.alph = alphabet[:base]
... |
mask=chosenMask
print('mask dimensions: {}'. format(mask.shape))
print('number of voxels in mask: {}'.format(np.sum(mask)))
# Compile preprocessed data and corresponding indices
metas = []
for run in range(1, 7):
print(run, end='--')
# retrieve from the dictionary which phase it is, assign the session
ph... |
def fibonnacci(nth: int) -> int:
if nth <= 1:
return 1
else:
return fibonnacci(nth - 1) + fibonnacci(nth - 2)
|
def parse_review(original_cleaned_value, soup, url, post):
if "review" in original_cleaned_value:
h_review = soup.select(".h-review")
if h_review:
h_review = h_review[0]
name = h_review.select(".p-name")[0].text
if not name:
name = s... |
"""Helper function and aspect to collect first-party packages.
These are used in node rules to link the node_modules before launching a program.
This supports path re-mapping, to support short module names.
See pathMapping doc: https://github.com/Microsoft/TypeScript/issues/5039
This reads the module_root and module_... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 8 19:15:34 2016
@author: ericgrimson
"""
US = ['MIT', 'Harvard', 'Yale']
UK = ['Cambridge', 'Oxford']
Unis = [US, UK]
Unisnew = [['MIT', 'Harvard', 'Yale'], ['US', 'UK']]
# US.append('Princeton') |
class Parkhaus:
"""
Class used to represent information about a car park
Attributes
----------
entry : str
how and/or where to enter the car park
entry : str
how and/or where to enter the car park
openingHours : str
opening hours of the car park
hightLimit : st... |
###################################
# File Name : enumerate.py
###################################
#!/usr/bin/python3
ALPHABET_LIST = ["a", "b", "c", "d", "e", "f"]
def get_index_basic_method():
i = 0
for ch in ALPHABET_LIST:
print ("%d : %s" % (i, ch))
i += 1
def get_index_enumerate_method()... |
def merge(dbag, data):
""" Simply overwrite the existsing bag as, the whole configuration is sent every time """
if "rules" not in data:
return dbag
dbag['config'] = data['rules']
return dbag
|
# -*- coding: utf-8 -*-
# @Time : 2021/11/1 9:19
# @Software : PyCharm
# @License : GNU General Public License v3.0
# @Author : xxx
__all__ = ["tools", "skflow", "sci_formula", "gp", "cli", "backend", "source"]
|
while True:
n = int(input())
if n == 0: break
l = 1
o = '+'
while l <= n:
v = l
c = 1
while c <= n:
if c != n: print('{:>3}'.format(v), end=' ')
else:
print('{:>3}'.format(v))
o = '-'
if v == 1: o = '+'
... |
def sort_012(input_list):
"""
Given an input array consisting on only 0, 1, and 2, sort the array in a single traversal.
Args:
input_list(list): List to be sorted
"""
pivot = 1
i, j, k = 0, 0, len(input_list) - 1
# print("Start ", input_list)
while j <= k:
if input_list[j... |
"""
The featurecollection module provides a class for GeoJSON responses.
"""
class FeatureCollection(object):
def __init__(self):
self.features = []
self.total_features = 0
self.offset = 0
def add_features(self, features):
self.features.extend(features)
self.total_feat... |
# Time: O(n)
# Space: O(n)
class Solution(object):
def shortestDistanceColor(self, colors, queries):
"""
:type colors: List[int]
:type queries: List[List[int]]
:rtype: List[int]
"""
dp = [[-1 for _ in range(len(colors))] for _ in range(3)]
dp[colors[0]-1][0]... |
#!/usr/bin/env python3
def trimmest(string):
stack = []
trimmed = ''
for i, c in enumerate(string):
if(c != ' '):
first = i
break
for i, c in enumerate(string[first:]):
stack.append(c)
stk_len = len(stack)
a = stk_len - 1
for i in range(stk_len):
... |
host = '0.0.0.0'
port = 8080
debug = True
CORS_HEADERS = 'Content-Type'
|
# Python3
def spiralNumbers(n):
matrix = [[0] * n for i in range(n)]
dirs = [(0, 1), (1, 0), (0, -1), (-1, 0)]
r, c = 0, 0
i = 0
dr, dc = dirs[i]
for num in range(1, n * n + 1):
matrix[r][c] = num
newR, newC = r + dr, c + dc
if (0 <= newR < n) and (0 <= newC < n) and (ma... |
# Copyright (c) 2013 Intel Corporation. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets' : [
{
'target_name': 'gio',
'type': 'none',
'variables': {
'glib_packages': 'glib-2.0 gio-unix-2.0',
},
... |
class BaseActiveLearningComponent:
def fit(self, X, y):
"""
Fits the estimator and returns a reference to itself.
"""
return self
def partial_fit(self, X, y):
"""
Updates the estimator given the data X, y.
Returns a reference to itself.
"""
... |
nums = [float(i) for i in input().split(" ")]
def rounding(numbers):
round_nums = [round(i) for i in numbers]
return round_nums
print(rounding(nums)) |
def lipschitz_opt_lb(model, initial_max=None, num_iter=100):
""" Compute lower bound of the Lipschitz constant with optimization on gradient norm
INPUTS:
* `initial_max`: initial seed for the SGD
* `num_iter`: number of SGD iterations
If initial_max is not provided, the model must have an in... |
# cup1 = 0
# cup2 = 1
# cup3 = 0
# cup1 = cup1 + 1
# cup2 = cup1 - 1
# cup3 =cup1
# cup1= cup1 * 0
# cup2 = cup3
# cup3 = cup1
# cup1 = cup2 % 1
# cup3 = cup2
# cup2 = cup3 - cup3
#
# word1 = 'ox'
# word2 = 'owl'
# word3 = 'cow'
# word4 = 'sheep'
# word5 = 'files'
# word6 = 'trots'
# word7 = 'runs'
# word8 = 'blue'
# ... |
class Solution:
def reachableNodes(self, edges: List[List[int]], maxMoves: int, n: int) -> int:
graph = [[] for _ in range(n)]
minHeap = [(0, 0)] # (d, u)
dist = [maxMoves + 1] * n
dist[0] = 0
for u, v, cnt in edges:
graph[u].append((v, cnt))
graph[v].append((u, cnt))
while minH... |
def middleware_setting(django_version, middleware_list):
if django_version < (1, 10):
return {'MIDDLEWARE_CLASSES': middleware_list}
else:
return {'MIDDLEWARE': middleware_list, 'MIDDLEWARE_CLASSES': None}
|
class Node:
def __init__(self, value=None):
self.value = value
self.next = None
class Stack():
def __init__(self):
self.top = None
def push(self, item):
new_node = Node(item)
new_node.next = self.top
self.top = new_node
def pop(self):
current = sel... |
#Given an array of ints, return the number of 9's in the array.
#array_count9([1, 2, 9]) → 1
#array_count9([1, 9, 9]) → 2
#array_count9([1, 9, 9, 3, 9]) → 3
def array_count9(lis):
return lis.count(9) |
class Game(object):
def __init__(self, game_pairs=0):
self.throws = []
self.game_pairs = game_pairs
def __call__(self, game_pairs=0):
self.game_pairs = game_pairs
def add_throw(self, throw):
self.throws.append(throw)
def check_value_range(self, value):
if value... |
def isStackFull() :
global SIZE, stack, top
if (top >= SIZE-1) :
return True
else :
return False
SIZE = 5
stack = ["커피", "녹차", "꿀물", "콜라", "환타"]
top = 4
print("스택이 꽉 찼는지 여부 ==>", isStackFull())
|
class LinearArray(BaseArray, IDisposable):
""" An object that represents an Array created linearly within the Revit project. """
@staticmethod
def ArrayElementsWithoutAssociation(
aDoc, dBView, ids, count, translationToAnchorMember, anchorMember
):
""" ArrayElementsWithoutAssocia... |
# -*- coding: utf-8 -*-
"""
Cuttle, the simple, extendable ORM.
:license: MIT, see LICENSE for details.
"""
__version__ = '0.9.0.dev'
|
#
# PySNMP MIB module CPQRECOV-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CPQRECOV-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:12:06 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... |
#Calc sum of digits of a given no.
print("enter any no.")
n=int(input())
ssum=0
while(n!=0):
x=n%10
n=n//10
ssum+=x
print(ssum)
|
boltzmann = 1.380649e-23
ideal_gas = 8.31446261815324
mole = 6.02214076e23
coulomb = 8.9875517923e9
e0 = 8.8541878128e-12
|
BASE_LANGUAGE_CODE = "en_US"
BASE_LANGUAGE_NAME = "English"
LANGUAGES_DICT = {
"de_DE": "Deutsch [ALPHA]",
"et_EE": "Eesti",
BASE_LANGUAGE_CODE: BASE_LANGUAGE_NAME,
"es_ES": "Español [ALPHA]",
"fr_FR": "Français [ALPHA]",
"nl_NL": "Nederlands [BETA]",
"pt_PT": "Português (PT) [BETA]",
"... |
# /$$
# | $$
# /$$$$$$ /$$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$
# /$$__ $$|____ /$$/ /$$__ $$ /$$__ $$ |____ $$ /$$__ $$
# | $$$$$$$$ /$$$$/ | $$ \__/| $$$$$$$$ /$$$$$$$| $$ | $$
... |
class Current:
def __init__(self):
self._voltage = 100000
@property
def voltage(self):
"""" Get the current voltage"""
return self._voltage
class Pizza(object):
def __init__(self):
self.toppings = []
def __call__(self, topping):
# when using '@instance_of_... |
"""
This file define basic configuration for RabbitMQ and Protobuf communication
for the simulation nodes and the orchestrator nodes.
"""
base_config = {
"name": "",
"queues": {
"obnl.simulation.node.": "on_simulation",
"obnl.local.node.": "on_local",
"obnl.data.node.": "on_data",
}... |
# Data Types
# Strings
print("Hello"[0])
# Integer
print(123 + 345)
# Float
3.14159
# Boolean
True
False |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
__all__ = ['xep_0004', 'xep_0009', 'xep_0012', 'xep_0030', 'xep_0033',
'xep_0045', 'xep_0050', 'xep_0060', 'xep_0066', 'xep_0082',
... |
# Print out numbers from 1 to 100 (including 100).
# But, instead of printing multiples of 3, print "Fizz"
# Instead of printing multiples of 5, print "Buzz"
# Instead of printing multiples of both 3 and 5, print "FizzBuzz".
for number in range(1, 101):
output = ''
if number % 3 == 0:
output += 'Fizz'
... |
'''
Refaça o DESAFIO 009, mostrando a tabuada de um número que o usuário escolher, só que agora utilizando um laço for.
'''
n1 = int(input('Digite o Valor que quer saber a Tabuada: '))
for c in range(1,11,):
print('{} X {} é = {}'.format(n1,c,n1*c)) |
"""
03. 円周率
"Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics."という文を単語に分解し,各単語の(アルファベットの)文字数を先頭から出現順に並べたリストを作成せよ.
"""
s = 'Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.'
words = s.replace(',', '').replace('.', '').split()
prin... |
class MinimalRegionSet():
def __init__(self):
self.local_set = []
def add(self, region):
local_set = self.local_set
add = True
for region_in_set in local_set:
if region_in_set.contains(region):
add = False
break
if region.... |
# !/bin/python
# -*- coding: utf-8 -*-
u"""SecureTea Social Engineering
Project:
╔═╗┌─┐┌─┐┬ ┬┬─┐┌─┐╔╦╗┌─┐┌─┐
╚═╗├┤ │ │ │├┬┘├┤ ║ ├┤ ├─┤
╚═╝└─┘└─┘└─┘┴└─└─┘ ╩ └─┘┴ ┴
Author: Digvijay Bhosale <digvijayb1729@gmail.com> August 15 2021
Version: 1.0
Module: SecureTea
"""
# This is a vestigal file.
#... |
# Small alphabet e using Function
def for_e():
""" *'s printed in the Shape of small e """
for row in range(5):
for col in range(5):
if col ==0 and row %4 !=0 or row %4 ==0 and col %4 !=0 or row ==1 or row ==3 and col ==4:
print('*',end=' ')
else:
... |
class Client:
"""
Class that creates new instances of client
"""
u_list = []
def __init__(self, fn, ln, email, password):
self.fn = fn
self.ln = ln
self.email = email
self.password = password
def save_client(self):
"""
Function to save clien... |
def Mona_lisa(thoughts, eyes, eye, tongue):
return f"""
{thoughts}
{thoughts}
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!>''''''<!!!!!!!!!!!!!!!!!!!!!!... |
class SettingsManager:
def __init__(self, client_class):
self._client = client_class
self.access_token = ''
def get_templates(self):
# https://api.dida365.com/api/v2/templates
pass
def get_user_settings(self):
# https://api.dida365.com/api/v2/user/preferences/setti... |
__author__ = 'Chetan'
class MyInt(type):
def __call__(cls, *args, **kwds):
print("***** Here's My int *****", args)
print("Now do whatever you want with these objects...")
return type.__call__(cls, *args, **kwds)
class int(metaclass=MyInt):
def __init__(self, x, ... |
class Coordinate(object):
def __init__(self, prefix, value):
self.prefix = prefix
self.value = value
def __str__(self):
if self.prefix:
if self.value:
return self.prefix + str(self.value)
else:
return self.prefix
else:... |
"""
This file assembles a toolchain for Linux using the Clang Compiler and musl.
It currently makes use of musl and not glibc because the pre-compiled libraries from the latter
have absolute paths baked in and this makes linking difficult. The pre-compiled musl library
does not have this restriction and is much easier... |
class Solution(object):
def dfs(self, start, end, record):
if start >= end:
return 0
if start + 1 == end:
return start
if record[start][end] is None:
pays = []
for i in range(start, end + 1):
prevPay = self.dfs(start, i - 1, r... |
class ExampleMod:
def __init__(self):
self.a = 6
self.b = 7
self.c = 8
def add(self):
return self.a + self.b + self.c
def multiply(self):
return self.a * self.b * self.c
|
"""Constants for Life360 integration."""
DOMAIN = 'life360'
CONF_AUTHORIZATION = 'authorization'
CONF_CIRCLES = 'circles'
CONF_DRIVING_SPEED = 'driving_speed'
CONF_ERROR_THRESHOLD = 'error_threshold'
CONF_MAX_GPS_ACCURACY = 'max_gps_accuracy'
CONF_MAX_UPDATE_WAIT = 'max_update_wait'
CONF_MEMBERS = 'members'
CONF_SHOW_... |
def inference_decoding_layer(embeddings, start_token, end_token, dec_cell, initial_state, output_layer,
max_summary_length, batch_size):
'''Create the inference logits'''
start_tokens = tf.tile(tf.constant([start_token], dtype=tf.int32), [batch_size], name='start_tokens')
... |
"""
:mod: `reports` -- Report Wrapper
=================================
.. module:: reports
:synopsis: Report building tools
:platform: OpenSuse 15.2 on WSL2 (Windows 10)
.. moduleauthor:: Bruno Lima <blcardoso@cos.ufrj.br>
"""
|
#ENV
#What environment the app is running in. Flask and extensions may enable behaviors based on the environment, such as enabling debug mode.
#The env attribute maps to this config key. This is set by the FLASK_ENV environment variable and may not behave as expected if set in code.
#Do not enable development when depl... |
#!/usr/bin/python3
#------------------------------------------------------------------------------
class Solution:
def fourSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[List[int]]
"""
# Each key in pairs will be the sum of the pair... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pylint: disable-msg=C0103, C0111
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
rvalue = b"Hello World\n"
rvalue += b"Test\n"
rvalue += b"Apr/14/2020\n"
return [rvalue]
|
"""
Module: 'onewire' on esp32 1.11.0
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v2.11.0.1 on 2019-07-26', machine='ESP32 module with ESP32')
# Stubber: 1.2.0
class OneWire:
''
MATCH_ROM = 85
SEARCH_ROM = 240
SKIP_ROM = 204
def _search_rom():
pass
def crc... |
p=31
q=37
r=43
n=p*q*r
print("n = p * q * r = " + str(n) + "\n")
phi=(p-1)*(q-1)*(r-1)
print("Euler's function (totient) [phi(n)]: " + str(phi) + "\n")
def gcd(a, b):
while b != 0:
c = a % b
a = b
b = c
return a
def egcd(a, b):
if a == 0:
return b, 0, 1
else:
g, y... |
class School:
def __init__(self):
self.grade_school = {}
def add_student(self, name, grade):
grade = str(grade)
value = self.grade_school.get(grade)
if value:
value.append(name)
self.grade_school.update({grade: value})
return
self.grad... |
L = [['3', 'Avaya_control_A', 'active'], ['4', 'Avaya_control_B', 'active'], ['5', 'Avaya_voice', 'active'], ['6', 'Avaya_phone', 'active'], ['60', 'MGMT_ALTF', 'active', 'Gi3/0/8,', 'Gi4/0/8'], ['78', 'UIB', 'active'], ['100', 'Video_recorder', 'active'], ['128', 'Srv_ALTF', 'active'], ['129', 'Srv_ALTF1', 'active'], ... |
#http://shell-storm.org/shellcode/files/shellcode-821.php
def reverse_tcp( HOST,PORT):
shellcode = r"\x01\x10\x8F\xE2"
shellcode += r"\x11\xFF\x2F\xE1"
shellcode += r"\x02\x20\x01\x21"
shellcode += r"\x92\x1a\x0f\x02"
shellcode += r"\x19\x37\x01\xdf"
shellcode += r"\x06\x1c\x08\xa1"
shel... |
class Solution(object):
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
integer = 0
values = {'M': 1000, 'D': 500, 'C': 100,
'L': 50, 'X': 10, 'V': 5, 'I': 1}
left = 1000
for i in s:
integer = integer + values[i]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.