Skip to content

Instantly share code, notes, and snippets.

View uysalserkan's full-sized avatar
🐉
model.predict(privateInput)==25

Serkan UYSAL uysalserkan

🐉
model.predict(privateInput)==25
View GitHub Profile
#!/bin/sh
# Check fisrt parameter and run python script with it
if [ "$1" = "ui" ]; then
streamlit run ui.py
elif [ "$1" = "api" ]; then
python3 api.py
else
echo "Invalid run type, please use 'ui' or 'api'."
fi
@uysalserkan
uysalserkan / timeout_decoration.py
Created August 13, 2024 17:21
Timeout decoration with multiprocessing library.
def timeout_decorator(timeout):
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
result_queue = multiprocessing.Queue()
def target_func(queue, *args, **kwargs):
try:
result = func(*args, **kwargs)
queue.put(result)
@uysalserkan
uysalserkan / upload_model_to_elasticsearch.py
Created August 2, 2023 13:15
Upload a hugging face model to Elastic Search Cluster
# Thnaks to SeaseLtd/vector-search-elastic-tutorial
import elasticsearch
from pathlib import Path
from eland.ml.pytorch import PyTorchModel
from eland.ml.pytorch.transformers import TransformerModel
# Elastic configuration.
ELASTIC_ADDRESS = "http://localhost:9200"
# Uncomment the following lines if start ES with SECURITY ENABLED.
#ELASTIC_ADDRESS = "https://localhost:9200"
@uysalserkan
uysalserkan / uysal.zsh-theme
Created September 6, 2022 07:32
Custom and basic zsh theme
# It's created by Serkan UYSAL; github:uysalserkan
# Set up git variables
autoload -Uz vcs_info
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr '%F{red}*'
zstyle ':vcs_info:*' stagedstr '%F{yellow}+'
zstyle ':vcs_info:*' actionformats '%F{5}[%F{2}%b%F{3}|%F{1}%a%c%u%F{5}]%f '
zstyle ':vcs_info:*' formats '%F{5}[%F{2}%b%c%u%F{5}]%f '
zstyle ':vcs_info:svn:*' branchformat '%b'
@uysalserkan
uysalserkan / better-commands-settings.json
Created November 16, 2021 06:41
Better commands tags
"better-comments.tags": [
{
"tag": "ERROR",
"color": "#FF0000",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=username
spring.mail.password=password
# Other properties
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.connectiontimeout=5000
spring.mail.properties.mail.smtp.timeout=5000
spring.mail.properties.mail.smtp.writetimeout=5000
@uysalserkan
uysalserkan / application.properties
Created July 1, 2021 06:00
application.properties spring boot mysql connection
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=admin
spring.datasource.password=my_amazing_passwordz
spring.datasource.url=jdbc:mysql://localhost:3306/employee_mng
spring.jpa.hibernate.ddl-auto=update
@uysalserkan
uysalserkan / hibernate.cfg.xml
Created June 26, 2021 09:06
hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/java_relation</property>
<property name="hibernate.connection.username">admin</property>
<property name="hibernate.connection.password">myPasswordExactlySame</property>
<!-- <property name="hibernate.connection.pool_size">1</property>
<property name="hibernate.current_session_context_class">thread</property>
@uysalserkan
uysalserkan / SudokuSolver.cpp
Created June 12, 2021 14:06
Sudoku Solver - Recursive function C++17 or above
/**
* @file SudokuSolver.cpp
* @author Serkan UYSAL (uysalserkan08)
* @brief Sudoku Solver with recursive functions and class.
* @version 0.1
* @date 2021-06-12
*
* @copyright Copyright (c) 2021
*
*/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.