repo_path stringlengths 7 115 | file_path stringlengths 1 197 | content stringlengths 10 2.81M | license_type stringclasses 2
values | size_bytes int64 10 2.81M |
|---|---|---|---|---|
amankayat/Portfolio | home/urls.py | from django.urls import path
from . import views
urlpatterns = [
path('',views.home,name = "home"),
path('blog/',views.blogpage,name="blog_page"),
path('blogdetails/<int:pk>',views.blogdetails,name="blogdetails")
]
| no_license | 235 |
amankayat/Portfolio | home/static/views.py | from django.shortcuts import render
from todo.models import todo_list
from django.http import HttpResponseRedirect
from django.urls import reverse
from todo.forms import addingtodo
def todo(requests):
form = addingtodo()
dat = todo_list.objects.order_by('date')
if requests.method=='POST':
form = ad... | no_license | 663 |
amankayat/Portfolio | home/views.py | from django.shortcuts import render
from home.models import Blog
# Create your views here.
def home(request):
blog = Blog.objects.all()
return render(request,'home/home.html',{
'blog':blog
})
def blogpage(request):
blog = Blog.objects.all()
return render(request,'home/blog_page.html',{
... | no_license | 487 |
amankayat/Portfolio | Portfolio/urls.py |
from django.contrib import admin
from django.urls import path,include,re_path as url
from django.contrib.staticfiles.urls import static, staticfiles_urlpatterns
from django.conf import settings
from django.views.static import serve
urlpatterns = [
url(r'^media/(?P<path>.*)$', serve,{'document_root': settings.MEDI... | no_license | 601 |
amankayat/Portfolio | home/models.py | from django.db import models
# Create your models here.
class Blog(models.Model):
title = models.CharField(max_length=500)
description = models.TextField()
date = models.DateTimeField()
image = models.ImageField(upload_to='blog_images')
def __str__(self) :
return self.title | no_license | 305 |
amankayat/Portfolio | home/templatetags/blog_extra.py | import markdown
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter
def convertmarkdown(value):
return markdown.markdown(value) | no_license | 212 |
amankayat/Portfolio | home/admin.py | from django.contrib import admin
# Register your models here.
from home.models import Blog
admin.site.register(Blog)
| no_license | 120 |
amankayat/Portfolio | Portfolio/settings.py | """
Django settings for Portfolio project.
Generated by 'django-admin startproject' using Django 4.0.3.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
from pathl... | no_license | 3,324 |
amankayat/Portfolio | home/static/views.py | from django.shortcuts import render
from todo.models import todo_list
from django.http import HttpResponseRedirect
from django.urls import reverse
from todo.forms import addingtodo
def todo(requests):
form = addingtodo()
dat = todo_list.objects.order_by('date')
if requests.method=='POST':
form = ad... | no_license | 663 |
amankayat/Portfolio | home/migrations/0001_initial.py | # Generated by Django 4.1 on 2023-01-07 08:18
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Blog',
fields=[
('id', models.BigAutoField(au... | no_license | 660 |
meierjoel-engineer/BackeBackeKuchen | read_usb_serial.py | import serial
import time
import numpy as np
# Set up the serial connection (adjust 'COM5' to your actual port)
ser = serial.Serial('COM5', 9600, timeout=1)
# Allow some time for the connection to establish
time.sleep(2)
# Initialize an empty list to store ADC values and timestamps
adc_values_with_timestamps = []
ti... | no_license | 1,860 |
meierjoel-engineer/BackeBackeKuchen | ESP/main.py | import socket
import time
import network
from machine import UART
# Configure UART for OpenScale
uart = UART(1, baudrate=115200, tx=5, rx=6)
def read_openscale(timeout=1, wait_interval=0.1):
waited_time = 0
while waited_time < timeout:
if uart.any():
return uart.readline()
time.sle... | no_license | 1,713 |
meierjoel-engineer/BackeBackeKuchen | plot_data.py | import numpy as np
import plotly.graph_objs as go
import plotly.io as pio
# Load the first NumPy array from the file
adc_values_array_1 = np.load('tiptopf.npy')
# Extract timestamps and ADC values for the first dataset
timestamps_1 = adc_values_array_1['timestamp']
adc_values_1 = adc_values_array_1['adc_value']
# Lo... | no_license | 1,333 |
meierjoel-engineer/BackeBackeKuchen | Server/Server.py | import socket
import sqlite3
from datetime import datetime
def init_db():
conn = sqlite3.connect('DB\data.db')
c = conn.cursor()
c.execute('''CREATE TABLE IF NOT EXISTS data (
id INTEGER PRIMARY KEY AUTOINCREMENT,
adc INTEGER,
temperature REAL,
... | no_license | 2,047 |
meierjoel-engineer/BackeBackeKuchen | DB/plot_db_data.py | data_path = 'DB/data1.db'
def plot_data():
import sqlite3
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from datetime import datetime
conn = sqlite3.connect(data_path)
c = conn.cursor()
c.execute('SELECT * FROM data')
data = c.fetchall()
conn.close()
sample... | no_license | 1,154 |
meierjoel-engineer/BackeBackeKuchen | ESP/main_deepsleep.py | from machine import UART
import time
import network
import socket
import time
import random
import machine
# Configure UART for OpenScale
uart = UART(1, baudrate=9600, tx=5, rx=6) # TX=1, RX=3 (adjust pins as needed)
def read_openscale():
while True:
if uart.any(): # Check if data is available
... | no_license | 2,302 |
adrien4g/docker-list | main.py | from app.docker_conf import DockerList
if __name__ == "__main__":
d = DockerList()
d.get_data() | no_license | 104 |
adrien4g/docker-list | app/docker_conf.py | import docker
from .utils import Utils
from configparser import ConfigParser
utils = Utils()
class DockerList:
data = []
def __init__(self):
self.dockerClient = docker.from_env()
self.client = docker.APIClient(base_url='unix://var/run/docker.sock')
self.config = ConfigParser()
... | no_license | 2,327 |
adrien4g/docker-list | app/utils.py | import os
import csv
import sys
from os import path
from configparser import ConfigParser
class Utils:
def __init__(self):
self.config = ConfigParser()
self.config.read('app/config.ini')
def verify_directorys(self):
if not path.exists(self.config['Default']['base_path']) or not pa... | no_license | 1,345 |
mtimet/dspres | demo/prepare_data_for_sklearn.py | #Adapt Data for Scikit Learn model fitting and predict
def prepare_data_for_sklearn(df, is_test=False):
x_columns = ['Hour','Month','Year','X','Y']
y_column = 'Category'
x_categorical_columns = ['DayOfWeek']
x_columns.extend(x_categorical_columns)
X = df[x_columns]
if len(x_categorical_c... | no_license | 575 |
mtimet/dspres | demo/load_and_enrich.py | from __future__ import print_function, division
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('ggplot')
%matplotlib inline
#load csv
%time train = pd.read_csv(r'data/train.csv', parse_dates=['Dates'])
%time test = pd.read_csv(r'data/train.csv', parse_dates=['Dates'])
%time sampl... | no_license | 654 |
micthialt/special-orders | specialorders.py | import cherrypy
import sqlite3 as lite
from mako.lookup import TemplateLookup
import os.path
path = os.path.abspath(os.path.dirname(__file__))
lookup = TemplateLookup(directories=[path + "/templates/"])
class SpecialOrders(object):
@cherrypy.expose
def index(self):
con = lite.connect("orders.db")
... | no_license | 6,390 |
tatiana-san/ascii-search | ascii-search.py | import StringIO
#This programme searchs custom string and returns the next n bytes after the first occurance
cfile=open("1.pdf", "rb")
data=cfile.read() #read the data from file
cfile.close()
data_decoded = str(data.decode('ascii', errors='ignore')) #create an ASCII string with the data from file
n=500 #number of by... | no_license | 1,239 |
jarteagar/OsinergminDll | setup.py | # setup.py
from setuptools import setup, find_packages
setup(
name='OsinergminDll',
version='0.1',
packages=find_packages(),
install_requires=[], # Puedes agregar dependencias aquí
)
| no_license | 203 |
jarteagar/OsinergminDll | OsinergminDll/__init__.py | import requests
import xml.etree.ElementTree as ET
from datetime import datetime
def OSVersion():
nota ='''Notas de la version***********************************
Version 1.3
en ultimo parametro "nOpcion" tiene 2 valores:
0 = envia el XML
1 = muestra el XML que se va a enviar
... | no_license | 11,870 |
shuaihaowang/TaskManager | task_manager_ui.py |
import tkinter as tk
from tkinter import ttk
from tkcalendar import DateEntry
import datetime
import json
class TaskManagerUI:
def __init__(self, root):
self.root = root
self.root.title("Task Manager")
self.root.geometry("900x600")
# Initialize the main frames
self.setup_f... | no_license | 14,050 |
shuaihaowang/TaskManager | main.py | import tkinter as tk
from task_manager_ui import TaskManagerUI
# Entry point of the application
if __name__ == "__main__":
root = tk.Tk()
app = TaskManagerUI(root)
root.protocol("WM_DELETE_WINDOW", app.on_closing) # Handle saving tasks on close
root.mainloop()
| no_license | 280 |
Twpiat/DMT | DMTReaderEx.py | import xlrd
# PODAJ NAZWĘ PLIKU DMT I PLIKU WSADOWEGO SQL
ExcelFileName = '../DMT002 136.xlsx'
# PO URUCHOMIENIU PROGRAM WYGENERUJE JEDEN WSAD
# ZE WSZYSTKIMI ZAPYTANIAMI DO WSZYSTKICH ZNALEZIONYCH TABEL EKSPORTOWYCH.
# UWAGA: OSTATNIE ZAPYTANIE SIĘ DUBLUJE, BEZ WPŁYWU NA DZIAŁANIE PROGRAMU.
output_file = "../EX SQL ... | no_license | 5,249 |
Twpiat/DMT | DMTreader.py | import xlrd
# PODAJ NAZWĘ PLIKU DMT
ExcelFileName = '../DMT002 140.xlsx'
# PODAJ NAZWĘ BAZY DANYCH
DatabaseName = "KT_ZT8_OTH"
# PODAJ NR PIERWSZEGO ISTOTNEGO WIERSZA
# (NR LINII EXCELA)
FirstRow = 8
# PODAJ NUMERY ISTOTNYCH KOLUMN W ZAKŁADCE,
# LICZĄC OD 0
ListColumns = (8, 10, 11, 12, 13)
# PODAJ NR PIERWSZEJ ... | no_license | 6,113 |
Twpiat/DMT | DMTreaderExport.py | import xlrd
# PODAJ NAZWĘ PLIKU DMT
ExcelFileName = 'DMT051 155.xlsx'
# PODAJ NAZWĘ BAZY DANYCH
DatabaseName = "ET_ZT7_DEF"
# PODAJ NR PIERWSZEGO ISTOTNEGO WIERSZA
# (NR LINII EXCELA)
FirstRow = 8
# PODAJ NUMERY ISTOTNYCH KOLUMN W ZAKŁADCE,
# LICZĄC OD 0
ListColumns = (67, 68, 70, 71, 73)
# PODAJ NR PIERWSZEJ I ... | no_license | 6,626 |
Berni1557/MTAL-CACS | src/model.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 1 09:41:53 2021
@author: <NAME>
"""
import torch
from torch import nn, optim
class MTALModel():
"""
MTALModel - Multi task model
"""
def __init__(self, device='cuda'):
# Init params
self.params=dict()... | no_license | 7,690 |
Berni1557/MTAL-CACS | src/cacs_predict.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 1 09:41:53 2021
@author: <NAME>
"""
import os, sys
import torch
from torch import nn, optim
from model import MTALModel
from glob import glob
import SimpleITK as sitk
import numpy as np
import pathlib
def main(args):
print('--- Start pro... | no_license | 5,020 |
reductist/dotfiles | .config/waybar/scripts/weather.old.py | #!/usr/bin/env python
import argparse
import json
from datetime import datetime
from sys import exit as sysexit
from typing import Any
import requests
parser = argparse.ArgumentParser(add_help=True)
parser.add_argument(
"--zip",
help="zip code",
type=str,
default="0",
required=False,
)
args = par... | no_license | 11,589 |
reductist/dotfiles | .config/wofi/windows_hypr.py | #!/bin/python3
from argparse import ArgumentParser
import subprocess
import json
enter="\n"
# hyprctl -j clients
# [{
# "address": "0xc1f0e890",
# "at": [10, 10],
# "size": [1900, 1060],
# "workspace": {
# "id": 3,
# "name": "3"
# },
# "floating": false,
# "monitor": 0,
# ... | no_license | 5,464 |
benkoger/gazelle-id-website | blogapp/views.py | from django.shortcuts import render, get_object_or_404, redirect
from django.utils import timezone
from .forms import PostForm
from .models import Post
def post_list(request):
posts = Post.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
return render(request, 'blogapp/post_list.... | no_license | 1,667 |
benkoger/gazelle-id-website | blogapp/migrations/0003_auto_20170807_1412.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-07 12:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blogapp', '0002_post_image'),
]
operations = [
migrations.AlterField(
... | no_license | 495 |
benkoger/gazelle-id-website | blogapp/migrations/0002_post_image.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-07 11:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blogapp', '0001_initial'),
]
operations = [
migrations.AddField(
... | no_license | 484 |
benkoger/gazelle-id-website | blogapp/models.py | from django.db import models
from django.utils import timezone
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.conf import settings
from PIL import Image
from io import BytesIO
import os.path
class Post(models.Model):
author = models.ForeignKey('auth.User')
title = models.CharFie... | no_license | 3,785 |
benkoger/gazelle-id-website | blogapp/migrations/0004_auto_20170807_1849.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-07 16:49
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('blogapp', '0003_auto_20170807_1412'),
]
operations = [... | no_license | 693 |
crvest/hello_world | hello_world.py | # 1. TASK: print "Hello World"
print("Hello World")
# 2. print "Hello Noelle!" with the name in a variable
name = "Chad"
print("Hello", name) # with a comma
print("Hello " + name) # with a +
# 3. print "Hello 42!" with the number in a variable
name = 2
print("Hello", name) # with a comma
print("Hello " + str(name)) # w... | no_license | 850 |
yuttie/Midway | change_glyph_width.py | #!/usr/bin/fontforge -script
import fontforge
import math
import psMat
import sys
def change_glyph_width(font, target_width):
for glyph in font.glyphs():
glyph.transform(psMat.skew(math.radians(font.italicangle)))
w = glyph.width
lsb = glyph.left_side_bearing
rsb = glyph.right_sid... | no_license | 1,030 |
yuttie/Midway | gen.py | #!/usr/bin/fontforge -script
import fontforge
import sys
gen_flags = (
'opentype',
'dummy-dsig',
'no-hints',
'no-flex',
'omit-instructions',
)
src_fp = sys.argv[1]
dest_fp = sys.argv[2]
font = fontforge.open(src_fp)
font.generate(dest_fp, flags=gen_flags)
font.close()
| no_license | 294 |
MYSGX/Fifth | pages/Chart.py | import streamlit as st
import yfinance as yf
import plotly.graph_objs as go
# Set up the sidebar for input
st.sidebar.header('Enter Ticker Symbol')
ticker_symbol = st.sidebar.text_input("Ticker Symbol")
# Get data on this ticker if provided, default to "AAPL" otherwise
if not ticker_symbol:
ticker_symbol = "AAPL"... | no_license | 3,011 |
MYSGX/Fifth | pages/model.py | import pandas as pd
import streamlit as st
import plotly.express as px
# Load the CSV file
csv_file = 'modelscores.csv' # Path to your CSV file
df = pd.read_csv(csv_file)
# Remove leading/trailing whitespace from column names
df.columns = df.columns.str.strip()
# Create a new column with ticker and company name
df[... | no_license | 3,565 |
MYSGX/Fifth | pages/Screening-underconstruction.py | import pandas as pd
import streamlit as st
import plotly.express as px
# Main function to calculate scores and display results
def main():
st.set_page_config(page_title='Ticker Scores')
st.header("Ticker Scores")
# Load the CSV file
csv_file = 'software.csv' # Path to your CSV file
df = pd.read_c... | no_license | 2,705 |
MYSGX/Fifth | pages/Factors.py | import pandas as pd
import streamlit as st
import plotly.express as px
# Load the CSV files
csv_file_factors = 'Factors4-26-2024.csv' # Path to your Factors CSV file
csv_file_cor = 'Cor4-30-24.csv' # Path to your Correlation CSV file
# Read both CSV files
df_factors = pd.read_csv(csv_file_factors)
df_cor = pd.read_... | no_license | 5,372 |
Anteb-Turtle/HeroesLounge-TeamStats | Widgets.py | import teamclasses as tc
import supportfunctions as fun
import ipywidgets as widgets
from ipywidgets import interact, interact_manual, interactive
from IPython.display import display
import plotly.express as px
import pandas as pd
import numpy as np
import datetime as dt
class TeamWidget(tc.TeamRawData):
... | no_license | 16,012 |
Anteb-Turtle/HeroesLounge-TeamStats | main.py | # -*- coding: utf-8 -*-
"""
MAIN
Set inputs and run to retreive data, calculate stats from the data, and plot the stats
"""
import teamclasses as tc
# =============================================================================
# INPUTS
# ====================================================================... | no_license | 2,386 |
Anteb-Turtle/HeroesLounge-TeamStats | formatdata.py | # -*- coding: utf-8 -*-
"""
Functions used to format and extract data from the matchs_data dictionnary
"""
def get_results(matchs_data, team_longname):
"""Returns a list containing a one for each win and a zero for each loss
"""
results = []
for match in matchs_data:
results = results... | no_license | 6,835 |
Anteb-Turtle/HeroesLounge-TeamStats | supportfunctions.py | # -*- coding: utf-8 -*-
"""
Other functions:
Sort/save/display
"""
import pandas as pd
from matplotlib import pyplot as plt
import numpy as np
def dict_to_dataframe(dic):
"""Converts data stored in a dictionnary to a pandas dataframe
Used for data visualization
"""
df = pd.DataFrame.... | no_license | 5,338 |
Anteb-Turtle/HeroesLounge-TeamStats | teamclasses.py | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 21 13:27:15 2020
@author: antoine.bierret
"""
# -*- coding: utf-8 -*-
""" Classes defninitions
"""
import json
import pandas as pd
import requests
import numpy as np
from bs4 import BeautifulSoup as soup
from matplotlib import pyplot as plt
import datet... | no_license | 19,663 |
keerthybalan/API_integration | bigquery_functions.py | from google.cloud import bigquery
def create_table(table_name, schema):
# create a table in bigquery
client = bigquery.Client()
table = bigquery.Table(table_name, schema=schema)
table = client.create_table(table) # Make an API request.
print(
"Created table {}.{}.{}".format(ta... | no_license | 1,512 |
End of preview. Expand in Data Studio
Stack-v3 Python Subset
A filtered subset of HuggingFaceCode/stack-v3-train containing only Python files with permissive or no_license licenses.
Statistics
- Total files: 70,000
- Unique repos: 9,134
- Total size: ~52 MB (Parquet)
- License breakdown: 1,599 permissive, 68,401 no_license
- Downloads last month
- -