Skip to content

Instantly share code, notes, and snippets.

View kgourgou's full-sized avatar
🪢
Back to tinkering

Kosti kgourgou

🪢
Back to tinkering
View GitHub Profile
@kgourgou
kgourgou / token_explorer.py
Created March 13, 2025 18:52
Token explorer
# very cool idea from Will Kurt: https://x.com/willkurt/status/1900080101431066673<D-s>
# pip install transformers torch readchar
#!/usr/bin/env python3
import os
import torch
import torch.nn.functional as F
from transformers import GPT2LMHeadModel, GPT2Tokenizer
import readchar
@yash98
yash98 / openrouter_dspy.py
Last active June 16, 2025 18:58
How to use Open Router ( openrouter.ai ) with DSPy
import requests
from os import getenv
from dsp import LM
from ratelimit import limits
RL_CALLS=40
RL_PERIOD_SECONDS=60
class OpenRouterClient(LM):
def __init__(self, api_key=None, base_url="https://openrouter.ai/api/v1", model="meta-llama/llama-3-8b-instruct:free", extra_headers=None, **kwargs):
@kgourgou
kgourgou / .spacemacs
Created June 5, 2019 16:22
spacemacs file
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@FradSer
FradSer / iterm2_switch_automatic.md
Last active April 6, 2025 09:19
Switch iTerm2 color preset automatic base on macOS dark mode.

The latest beta (3.5) includes separate color settings for light & dark mode. Toggling dark mode automatically switches colors.

Vist iTerm2 homepage or use brew install iterm2-beta to download the beta. Thanks @stefanwascoding.


  1. Add switch_automatic.py to ~/Library/ApplicationSupport/iTerm2/Scripts/AutoLaunch with:
@mollymerp
mollymerp / sshfs-gcp-instance-osx.md
Last active August 4, 2025 08:07
How to mount a GCP compute instance filesystem locally using `sshfs` on MacOS

How to mount a GCP compute instance filesystem locally using sshfs

This guide assumes that:

  • you already have an instance set up on GCP that you want to mount locally
  • the GCP CLI (gcloud) is installed on your local machine
  • you have authenticated locally to your google account gcloud auth login
  1. make sure your gcloud config is correct for the instance you're trying to access:
@bradtraversy
bradtraversy / pipenv_cheat_sheet.md
Last active August 27, 2025 18:43
Pipenv cheat sheet for common commands

Pipenv Cheat Sheet

Install pipenv

pip3 install pipenv

Activate

pipenv shell
@bishboria
bishboria / springer-free-maths-books.md
Last active July 17, 2025 06:34
Springer made a bunch of books available for free, these were the direct links
@gerbsen
gerbsen / ssh_agent_start.fish
Last active May 15, 2025 03:26 — forked from schaary/ssh_agent_start.fish
Auto-launching ssh-agent in fish shell
# content has to be in .config/fish/config.fish
# if it does not exist, create the file
setenv SSH_ENV $HOME/.ssh/environment
function start_agent
echo "Initializing new SSH agent ..."
ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV
echo "succeeded"
chmod 600 $SSH_ENV
. $SSH_ENV > /dev/null
@cscorley
cscorley / jekyll.py
Last active January 9, 2021 21:47
IPython to Jekyll Markdown
try:
from urllib.parse import quote # Py 3
except ImportError:
from urllib2 import quote # Py 2
import os
import sys
BLOG_DIR = os.environ['BLOG_DIR']
# BLOG_DIR = '/Users/cscorley/git/cscorley.github.io/'