Skip to content

Commit

Permalink
2024-07-10 17:11:06.924230 new snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardocerqueira committed Jul 10, 2024
1 parent 6ce6848 commit 9879271
Show file tree
Hide file tree
Showing 17 changed files with 683 additions and 698 deletions.
31 changes: 31 additions & 0 deletions seeker/report.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
--------------------------------------------------------------------------------
2024-07-10 17:11:06.924230
--------------------------------------------------------------------------------
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: snippet/.py
deleted: snippet/333.py
deleted: snippet/homework.py
deleted: snippet/mac-linux-colors.sh
deleted: snippet/rglob_vs_walk_vs_ThreadPoolExecutor.py
deleted: snippet/setup.sh
deleted: snippet/states.py
modified: snippet/transformer.py

Untracked files:
(use "git add <file>..." to include in what will be committed)
snippet/TelegraphUp.py
snippet/api.go
snippet/dash_cards_uneven_grid.py
snippet/dash_pivot_charts.py
snippet/main.go
snippet/main.py
snippet/smaple_app_with_routes.py
snippet/surfrider.py

no changes added to commit (use "git add" and/or "git commit -a")

--------------------------------------------------------------------------------
2024-07-09 17:12:50.821088
--------------------------------------------------------------------------------
Expand Down
72 changes: 0 additions & 72 deletions seeker/snippet/.py

This file was deleted.

91 changes: 0 additions & 91 deletions seeker/snippet/333.py

This file was deleted.

56 changes: 56 additions & 0 deletions seeker/snippet/TelegraphUp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#date: 2024-07-10T16:53:49Z
#url: https://api.github.com/gists/71ba97cd59962409e1eb4d5dd0f3e208
#owner: https://api.github.com/users/Nyashyker

from pprint import pprint
from pathlib import Path

# https://python-telegraph.readthedocs.io/en/latest/telegraph.html
import telegraph


def setContent(pictures: list) -> list:
content: list = []
for pic in pictures:
content.append(
{
"tag": "figure",
"children": [
{"tag": "img", "attrs": {"src": pic}},
{"tag": "figcaption", "children": [""]},
],
}
)
return content


def uploadPictures(folder: Path) -> list[str]:
"""
Працює тільки з .jpg
"""

pictures: list = []
for img in folder.glob("*.jpg"):
pictures.append(TG.upload_file(img)[0]["src"])

return pictures


TG = telegraph.api.Telegraph(
"5fc3709d100f62b276ec573a389a11ea267692f67f6999e4568426a9105d"
)
# TG.create_account("DP", "Даєш переклад!")
# print(TG.get_access_token(), end= "**********"

path = Path
pictures: list[str] = uploadPictures()

# result = TG.edit_page(
result = TG.create_page(
# path="",
title="TestTestTest",
content=setContent(pictures),
author_name="",
author_url="",
)
pprint(result)
33 changes: 33 additions & 0 deletions seeker/snippet/api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//date: 2024-07-10T16:55:53Z
//url: https://api.github.com/gists/3ee12b530dc49c2dc093fc53e89d4427
//owner: https://api.github.com/users/BK1031

package main

import (
"net/http"
"time"

"github.com/gin-gonic/gin"
)

var Port = "9000"

func StartServer() {
r := gin.Default()
r.GET("/ecu", GetAllECUs)
r.GET("/battery", GetAllBatteries)
r.Run(":" + Port)
}

func GetAllECUs(c *gin.Context) {
var ecus []ECU
DB.Find(&ecus)
c.JSON(http.StatusOK, ecus)
}

func GetAllBatteries(c *gin.Context) {
var batteries []Battery
DB.Find(&batteries)
c.JSON(http.StatusOK, batteries)
}
Loading

0 comments on commit 9879271

Please sign in to comment.