Skip to content

Instantly share code, notes, and snippets.

View pteacher's full-sized avatar
🐢
I may be slow to respond.

Ruslan Isaev pteacher

🐢
I may be slow to respond.
View GitHub Profile
@pteacher
pteacher / wiki_text_mining.py
Created April 10, 2023 13:33
Text mining and scrapping from Wikipedia (List of Scientists)
import wikipedia
import pandas as pd
import string
page = wikipedia.page("List of chemists")
scientists_dict = {"scientist": [], "summary": [], "birth_year": []}
for p in page.links[:2]:
scientist = wikipedia.page(p)
scientists_dict["scientist"].append(p)
summary = scientist.summary
@pteacher
pteacher / application.properties
Created March 9, 2023 09:15
Spring boot postgresql properties with environment variables
spring.datasource.url=jdbc:postgresql://localhost:5432/webapp
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.username=${SPRING_DB_USER}
spring.datasource.password=${SPRING_DB_PASS}
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=create
spring.sql.init.mode=always
spring.jpa.defer-datasource-initialization=true
@pteacher
pteacher / StudentController.java
Created February 21, 2023 09:43
Lecture example with REST API on students Spring Boot JPA
package kg.edu.alatoo.demo.controller;
import kg.edu.alatoo.demo.model.Student;
import kg.edu.alatoo.demo.repository.StudentRepository;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Optional;
@RestController
@pteacher
pteacher / MainController.java
Created February 7, 2023 11:23
Spring Boot with Thymeleaf and JPA (H2)
package com.example.demo.controller;
import com.example.demo.repo.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class MainController {
@pteacher
pteacher / main.py
Created November 25, 2022 11:13
Python voice recognition using vosk for Turkish language
import os
import wave
from vosk import Model, KaldiRecognizer
import json
import librosa
import soundfile as sf
def get_text_from_voice(filename):
if not os.path.exists("model"):
@pteacher
pteacher / index.html
Created October 21, 2022 09:28
Guess the word with Arrays and DOM example for COM21 students at AIU
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JavaScripts Arrays Example</title>
<link rel="stylesheet" href="css/style.css">
<script src="js/main.js" defer></script>
</head>
<body onload="getData()">
@pteacher
pteacher / fetch.html
Created October 20, 2022 04:24
Fetch API example with public-api for dogs (AIU COM21 students)
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" defer>
function loadData() {
fetch('https://dog.ceo/api/breeds/image/random')
.then((response) => response.json())
.then((data) => {
@pteacher
pteacher / firmware.ino
Created August 23, 2022 10:40
Makelangelo for 28byj-48 stepper motor Arduino
//------------------------------------------------------------------------------
// Draw robot
// dan@marginallycelver.com 2012 feb 11
//------------------------------------------------------------------------------
// Copyright at end of file. Please see
// http://www.github.com/MarginallyClever/Makelangelo for more information.
#define FORWARD 1
#define BACKWARD -1
@pteacher
pteacher / wonder.js
Created April 5, 2021 09:10
Поле чудес (Field of Wonders) пример игры PIXI.js
const app = new PIXI.Application({
width: window.innerWidth,
height: window.innerHeight,
backgroundColor: 0xffffff,
resolution: window.devicePixelRatio || 1,
});
document.body.appendChild(app.view);
const w = window.innerWidth;
const h = window.innerHeight;
@pteacher
pteacher / api_ajax.html
Created December 7, 2020 05:56
API Example for COM19
<!DOCTYPE html>
<html>
<head>
<title>API Example</title>
<script type="text/javascript">
function get_dog() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
console.log(this.status);
if (this.readyState == 4 && this.status == 200) {