Skip to content

Instantly share code, notes, and snippets.

View mertbozkir's full-sized avatar
🔥
Delayed Gratification!

Mert Bozkir mertbozkir

🔥
Delayed Gratification!
View GitHub Profile
@mertbozkir
mertbozkir / postgres.md
Created October 10, 2024 23:00 — forked from phortuin/postgres.md
Set up postgres + database on MacOS (M1)

Based on this blogpost.

Install with Homebrew:

$ brew install postgresql@14

(The version number 14 needs to be explicitly stated. The @ mark designates a version number is specified. If you need an older version of postgres, use postgresql@13, for example.)

@mertbozkir
mertbozkir / watch-server.md
Created September 20, 2024 00:21
Showing executed commands and outputs on thinkpad server!

To watch and monitor the Tailscale session commands and their outputs on your ThinkPad (Ubuntu server) without a GUI, you can use a terminal-based monitoring tool. One excellent option for this is tmux (Terminal Multiplexer). Here's how you can set this up:

  1. Install tmux on your ThinkPad:

    sudo apt install tmux
    
  2. Start a new tmux session:

    tmux new -s tailscale_monitor
    
@mertbozkir
mertbozkir / q2.asm
Created September 2, 2024 06:24
prework
DATA DB 0.9, 2.7, 6.7, 11.5, 16.5, 20.6, 24.2, 24.3, 19.6, 13.9, 7.3, 2.8
MOV CX,12 ; Set counter to 12 months
SUB BX,BX ; Clear BX, used as accumulator
MOV SI,OFFSET DATA ; Set up pointer
BACK: MOV AL,[SI] ; Move byte into AL
CBW ; Convert byte to word, add 1's to AH to extend AL to AX
ADD BX,AX ; Add to BX
INC SI ; Increment pointer
DEC CX ; Decrement counter
JNZ BACK ; Loop if not finished
@mertbozkir
mertbozkir / docs.md
Last active August 23, 2024 08:31
Llama.cpp client for python (fastest way!)

Llama.cpp Client for Python

This Python client allows you to interact with a locally deployed llama.cpp server using an OpenAI-compatible API. It provides a simple interface to send prompts and receive responses from your local language model.

Setup

  1. Start llama.cpp server:

    Navigate to your llama.cpp directory and run:

from langchain_groq import ChatGroq
from langchain_core.prompts import ChatPromptTemplate
from langchain.schema import StrOutputParser
from langchain.schema.runnable import Runnable
from langchain.schema.runnable.config import RunnableConfig
from typing import Dict, Optional
import chainlit as cl
import logging
from chainlit import logger
@mertbozkir
mertbozkir / upload.md
Last active June 27, 2024 14:11
Uploading model to ollama! 🤙

Push a new model:

ollama pull llama2
echo "FROM llama2" >> Modelfile
echo "SYSTEM You are a friendly assistant." >> Modelfile
ollama create -f Modelfile mertbozkir/test
ollama push mertbozkir/test

or push an existing model:

@mertbozkir
mertbozkir / cypher.zsh-theme
Last active June 22, 2024 21:44
Updated Cypher theme with virtualenv
# Based on evan's prompt
# Shows the exit status of the last command if non-zero
# Uses "#" instead of "»" when running with elevated privileges
# local venv_prompt='$(virtualenv_prompt_info)'
# PROMPT='%{${fg_bold[blue]}%}$(virtualenv_prompt_info)'
PROMPT="%m %{${fg_bold[red]}%}::%{${fg[green]}%} %3~%{${reset_color}%} $(virtualenv_prompt_info)%(0?. . ${fg[red]}%? )%{${fg[blue]}%}» "
# PROMPT="%{${fg_bold[white]}%} %m %{${fg_bold[red]}%}:: %{${fg[green]}%}%3~%(0?. . %{${fg[red]}%}%? )%{${fg[blue]}%}$(virtualenv_prompt_info)» %{${reset_color}%}"
ZSH_THEME_VIRTUALENV_PREFIX=""
ZSH_THEME_VIRTUALENV_SUFFIX=""
@mertbozkir
mertbozkir / plot_importance.py
Last active May 14, 2022 12:58
Plotting feature importances for machine learning model.
def plot_importance(model, features, num = len(X), save = False):
feature_imp = pd.DataFrame({'Value': model.feature_importances_, 'Feature': features.columns})
plt.figure(figsize = (10, 10))
sns.set(font_scale = 1)
sns.barplot(x = 'Value', y = 'Feature',
data = feature_imp.sort_values(by = 'Value', ascending = False)[0:num])
plt.title('Features')
plt.tight_layout()
plt.show()
if save:
@mertbozkir
mertbozkir / val_curve_params.py
Last active May 14, 2022 12:58
Learning Curves Plotting function
def val_curve_params(model, X, y, param_name, param_range, scoring = 'roc_auc', cv = 10):
train_score, test_score = validation_curve(
model, X = X, y = y, param_name = param_name, param_range = param_range, scoring = scoring, cv = cv)
mean_train_score = np.mean(train_score, axis = 1)
mean_test_score = np.mean(test_score, axis = 1)
plt.plot(param_range, mean_train_score,
label = 'Training Score', color = 'b')
plt.plot(param_range, mean_test_score,
@mertbozkir
mertbozkir / LinearRegression.ipynb
Last active May 12, 2022 08:21
Simple Linear Regression with Gradient Descent from Scratch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.