Skip to content

Instantly share code, notes, and snippets.

@dteoh
dteoh / feker-ik65-mac-via-how-to.md
Created July 27, 2024 12:33
How to upgrade Feker IK65 firmware on Mac

If you use a Mac and want to upgrade the firmware of your Feker IK65 keyboard to get VIA support, this guide is for you. I will just list the high level steps to take. I will assume that the keyboard is connected over USB.

Where to get the firmware

At the time of writing, you get it from [Epomaker's website][1]. If this link doesn't work, search for "feker" on their website. I noticed that the link to the firmware calls it an lk65 (lowercase L vs uppercase I), which explains why I found it so difficult to find this software on search engines.

@dteoh
dteoh / article_starcoder_macbook.md
Last active March 18, 2024 10:20
How to run StarCoderBase 1B SFT on a MacBook Pro with Apple Silicon

How to run StarCoderBase 1B SFT on a MacBook Pro with Apple Silicon

These are notes on how I managed to get StarCoderBase-1B-SFT model compiled into a quantized version such that it can run locally on my MBP M1 Pro and be queryable through an OpenAI API-compatible server. [StarCoderBase][1] is a model trained/tuned for programming tasks. The [1B parameters SFT model][2] I am using in this article is a version of the model that has had supervised fine tuning applied to it. I am just going to call this "StarCoder" in the rest of this article for the sake of simplicity. Number of parameters that a model has is going to impact resource usage, so a smaller version of the model makes it more

@dteoh
dteoh / command.md
Created September 15, 2021 00:26
Interactively delete git branches locally

Delete multiple Git branches with a UI

This assumes you have installed [fzf][1].

$ git branch --no-color | fzf -m | xargs -I {} git branch -D '{}'

Press tab to mark a branch, shift-tab to unmark. Press enter and all marked branches will be deleted.

@dteoh
dteoh / albedo_vs_mona_crafting_talent.md
Last active June 23, 2021 12:15
Genshin Impact: Albedo vs Mona crafting talent, who is better?

Genshin Impact: Albedo vs Mona crafting talent, who is better?

In Genshin Impact, you can craft materials of a given rank from three materials of the rank just below, eg. you can craft one gold book from three blue books.

Albedo has a talent where crafting a weapon ascension material has a 10% chance of giving double the output. Mona has a talent where crafting a weapon ascension material has a 25% chance of refunding a portion of the input materials.

@dteoh
dteoh / rspec_rails_set_session.md
Created May 29, 2020 07:49
Setting session variables in an RSpec Rails request spec

Setting session variables in an RSpec Rails request spec

You are writing a spec with type: :request, i.e. an integration spec instead of a controller spec. Integration specs are wrappers around Rails' ActionDispatch::IntegrationTest class. I usually write controller tests using this instead of type: :controller, mainly because it exercises more of the request and response handling stack. So instead of writing something like get :index to start the request, you would write get books_path or similar.

One of the issues with using type: :request is that you lose the ability to

@dteoh
dteoh / mysql2-gem-install.md
Created November 22, 2019 01:18
Installing mysql2 gem

Installing mysql2 gem

This is always an annoying process, especially when you are setting up a new computer. I assume you are using macOS + homebrew. I also assume that you want to run an older version of MySQL (although the instructions should be adaptable).

Installing MySQL

$ brew install mysql@5.7 # change the version if needed
@dteoh
dteoh / dictionary.md
Created October 23, 2019 03:13
Display dictionary definition on macOS
  1. Move mouse cursor to point at a word
  2. Press Command + Ctrl + D
@dteoh
dteoh / custom_ar_relation_relay_connection.rb
Last active October 28, 2019 16:51
GrapQL Ruby: Custom Relay connection class for ActiveRecord::Relation objects
# This custom relay connection class exists because the built-in connection
# class is broken when max_page_size is used.
#
# See: https://github.com/rmosolgo/graphql-ruby/issues/1109
class CustomArRelationRelayConnection < GraphQL::Relay::BaseConnection
def cursor_from_node(item)
cursor_col = item.class.implicit_order_column
encode(item.send(cursor_col).to_s)
end
@dteoh
dteoh / cors-curl.md
Created September 26, 2019 23:56
Check CORS headers with `curl`
$ curl -X OPTIONS -H “Origin: REQUESTER-DOMAIN.com” -H “Access-Control-Request-Method: GET“ -s -v <TARGET URL HERE> 1> /dev/null
@dteoh
dteoh / neovim_python.md
Last active November 13, 2020 05:27
NeoVim + Python 3 provider

Assuming that [Conda][1] is used, start by creating an environment for NeoVim:

$ conda create -n neovim36 python=3.6

Fish shell users:

$ source (conda info --root)/etc/fish/conf.d/conda.fish