Skip to content

Instantly share code, notes, and snippets.

@liyu1981
liyu1981 / ollama_ubuntu.md
Last active May 15, 2025 23:56
make ollama listen to external in ubuntu

Problem

After installed ollama in ubuntu, the usual use will be fine, but when want to access it from another machine (like from your laptop to home lab server), will see

yli@yli-hx90g:~$ curl http://192.168.0.163:11434/api/generate -d '{"model": "deepseek-r1:7b", "keep_alive": -1}'
curl: (7) Failed to connect to 192.168.0.163 port 11434 after 3 ms: Connection refused
@liyu1981
liyu1981 / Readme.MD
Created May 15, 2025 00:59
restart ollama for using gpu in ubuntu
@liyu1981
liyu1981 / README.md
Created March 5, 2025 09:37
example of how to stream file uploading with undici
@liyu1981
liyu1981 / README.md
Last active January 1, 2025 22:41
git alias for prune remote branches & remove local branches not tracking any remote
@liyu1981
liyu1981 / cb_provision_web.py
Created November 7, 2023 03:08
provision_web
import datetime
import pathlib
import sys
import threading
import re
import subprocess
from pathlib import Path
from zipfile import ZipFile, ZIP_DEFLATED
from bottle import request, route, run, static_file
@liyu1981
liyu1981 / make_animate_train.py
Last active April 12, 2023 08:54
A simple function to animate the training process in google colab with PyTorch
# Usage:
# just copy this function into your google colab notebook, then use it
# a working example can be seen in this demo notebook:
# https://colab.research.google.com/drive/19Ni0EfOExQmTcrFZh3Z6DxsOM25KULqN?usp=sharing
import matplotlib.pyplot as plt
from matplotlib import animation, rc
def make_animate_train(train_step_fn, animate_setup_fn):
"""
@liyu1981
liyu1981 / consoleColors.js
Created October 1, 2022 06:05 — forked from abritinthebay/consoleColors.js
The various escape codes you can use to color output to StdOut from Node JS
// Colors reference
// You can use the following as so:
// console.log(colorCode, data);
// console.log(`${colorCode}some colorful text string${resetCode} rest of string in normal color`);
//
// ... and so on.
export const reset = "\x1b[0m"
export const bright = "\x1b[1m"
export const dim = "\x1b[2m"
@liyu1981
liyu1981 / .zshrc
Last active May 1, 2020 01:36
My Zsh backup & install
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel9k/powerlevel9k"
. ~/.zshtheme
ENABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true"
plugins=(
'use strict';
class Abstract {
// A static abstract method.
static foo() {
if (this === Abstract) {
// Error Type 2. Abstract methods can not be called directly.
throw new TypeError("Can not call static abstract method foo.");
} else if (this.foo === Abstract.foo) {
// Error Type 3. The child has not implemented this method.
throw new TypeError("Please implement static abstract method foo.");
@liyu1981
liyu1981 / workchat-update.sh
Created March 12, 2019 00:11
update script for nativefier-workchat
#!/bin/bash
echo "create new version of nativefier-wrokchat"
nativefier -i ./workplace.png https://fb.workplace.com -n nativefier-workchat
if [ -d "/Applications/nativefier-workchat.app" ]; then
echo "backup..."
mv /Applications/nativefier-workchat.app ~/Desktop/nativefier-workchat-backup.app
echo "done => ~/Desktop"
fi