Skip to content

Instantly share code, notes, and snippets.

"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@garrett
garrett / ollama-start.sh
Created June 25, 2024 18:43
ollama with rocm (AMD GPU) and webui, in podman
podman run --pull newer --detach --security-opt label=type:container_runtime_t --replace --device /dev/kfd --device /dev/dri -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama:rocm; podman run --replace --pull newer -d --network=host -v open-webui:/app/backend/data -e OLLAMA_BASE_URL=http://127.0.0.1:11434 --name open-webui --restart always ghcr.io/open-webui/open-webui:main
@kconner
kconner / macOS Internals.md
Last active March 4, 2026 17:23
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@cp-radhika-s
cp-radhika-s / MainActivity.java
Last active November 13, 2024 12:01
Android - Connecting your app to a Wi-Fi connection which might not have internet
public class MainActivity extends AppCompatActivity implements WifiChangeBroadcastReceiver.WifiChangeBroadcastListener {
private WifiManager wifiManager;
private ConnectivityManager connectivityManager;
private WifiChangeBroadcastReceiver wifiStateChangeReceiver;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
@tanaikech
tanaikech / submit.md
Created November 10, 2020 06:32
Downloading Google Spreadsheet as XLSX and PDF file by Clicking Button

Downloading Google Spreadsheet as XLSX and PDF file by Clicking Button

This is a sample script for downloading Google Spreadsheet to the local PC as a XLSX file and a PDF file when a button on the side bar and the dialog is clicked. This is created with Google Apps Script and HTML&Javascript.

Sample script

Please create new Google Spreadsheet and copy and paste the following scripts to the script editor. And please run openSidebar(). By this, the side bar is opened to the Spreadsheet.

@smac89
smac89 / post.md
Last active February 18, 2026 12:55
Xfce Lockscreen with xsecurelock and xscreensaver #linux #xfce
  • Install both xscreensaver and xsecurelock using your package manager

  • Make sure xscreensaver is not set to lock the screen or to manage the display. Xfce aleady does all those, so there is no need to enable it again.

  • Also make sure that the xscreensaver daemon is not autostarted. Not doing this may result in the screen not being locked.

  • Set the following environmental variables (in ~/.xprofile or ~/.xsession) for xsecurelock:

    # xsecurelock options
    

export XSECURELOCK_SAVER=saver_xscreensaver

@IanColdwater
IanColdwater / twittermute.txt
Last active March 8, 2026 00:11
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@mikeboiko
mikeboiko / tmux.conf
Last active July 6, 2025 19:50
Automatically update $DISPLAY for each tmux pane after attaching to session
set-hook -g client-attached 'run-shell /bin/update_display.sh'
@douglashill
douglashill / main.m
Last active January 9, 2026 22:02
A minimal iOS app set up entirely in code using Objective-C rather than using a storyboard and UIApplicationSceneManifest in the Info.plist.
// A minimal iOS app set up entirely in code using Objective-C rather than using a storyboard and UIApplicationSceneManifest in the Info.plist.
// Last updated for iOS 18.
// Swift version: https://gist.github.com/douglashill/b8125f7e2336b6a47461df0d4898f64d
@import UIKit;
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>
@end
@implementation SceneDelegate
/**
* Pivot the scene when user enters VR to face a target.
*/
AFRAME.registerComponent('recenter', {
schema: {
target: {default: ''}
},
init: function () {
var sceneEl = this.el.sceneEl;