Skip to content

Instantly share code, notes, and snippets.

View afrog33k's full-sized avatar

Ronald Adonyo afrog33k

View GitHub Profile
@afrog33k
afrog33k / l3min.py
Created August 15, 2024 17:10 — forked from awni/l3min.py
"""
A minimal, fast example generating text with Llama 3.1 in MLX.
To run, install the requirements:
pip install -U mlx transformers fire
Then generate text with:
python l3min.py "How tall is K2?"
@afrog33k
afrog33k / popos-nvidia-docker.md
Created April 22, 2023 09:33 — forked from kuang-da/popos-nvidia-docker.md
[Install nvidia-docker2 In Pop!_OS]#popos

Introduction

This gist is a note about install nvidia-docker in Pop!_OS 20.10. nvidia-docker is used to help docker containers compute on GPU.

The basic installcation is in Nvidia's offical documentation. But there are a few tweaks to make it work on Pop!_OS 20.10.

Setting up Docker

No surprise. Follow the offical documentaion should work.

Setting up NVIDIA Container Toolkit

Keybase proof

I hereby claim:

  • I am afrog33k on github.
  • I am afrog33k (https://keybase.io/afrog33k) on keybase.
  • I have a public key ASBmKshh0Ely5B0WoEQ1JiHQCnxUcGz6wheYSa8qG4VHZQo

To claim this, I am signing this object:

# Building a Javascript module bunder
## Introduction
*Source*: https://github.com/jackpopp/bundler/blob/master/src/index.js
A Javascript module bundler is a tool that allows you to bundle multiple Javascript modules together in to a single or multiple output files. Separating your JS code into multiple modules and requiring shared modules from package management repositories is a common practice in modern web development. Javascript in the browser has not natively supported modules (although some browsers are starting to) and so module bundling is required to glue all the modules together. There's several different ways that modules can be bundled including AMD, Common JS and Import methods, the Javascript runtime Node popularised Common JS and we'll build our bundler to support this. There's several popular Javascript bundlers that have been around for a while webpack being one of the most common, others include Rollup, Browserify and Parcel.
The bundler takes Javascript source code, processes it, trans
@afrog33k
afrog33k / index.md
Created January 24, 2019 08:47 — forked from mathisonian/index.md
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration

@afrog33k
afrog33k / custom.conf
Created August 29, 2018 08:51 — forked from kalepail/custom.conf
My custom mechanic.conf template for rolling deployments on Meteor
{# Let folks know this wasn't a manual configuration #}
# This configuration file was generated with mechanic.
{% macro server(site, settings, options) %}
include "{{ settings.overrides }}/{{ site.shortname }}/top";
server {
gzip on;
@afrog33k
afrog33k / letsencrypt_2016.md
Created March 5, 2017 09:25 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two modes when you don't want Certbot to edit your configuration:

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80) to renew certificates.

In the following, we're setting up mydomain.com to be served from /var/www/mydomain, and challenges will be served from /var/www/letsencrypt.