Skip to content

Instantly share code, notes, and snippets.

@johnmcfarlane
johnmcfarlane / begin(C++).md
Last active May 15, 2024 07:07
Resources for C++ beginners
//
// ViewController.swift
// Dicee-iOS13
//
// Created by Angela Yu on 11/06/2019.
// Copyright © 2019 London App Brewery. All rights reserved.
//
import UIKit
@mwaskom
mwaskom / replacing_seaborn_distplot.ipynb
Last active May 15, 2024 07:05
A guide to replacing the deprecated `seaborn.distplot` function.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wojteklu
wojteklu / clean_code.md
Last active May 15, 2024 07:02
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@0
0 / bluetooth_serial.md
Last active May 15, 2024 07:01
Connecting a Bluetooth device for serial communication on Arch Linux.

The following are instructions for connecting a Bluetooth device for serial communication on Arch Linux using BlueZ 5.31.

Prerequisites

The following packages are required:

  • bluez: bluetoothd
  • bluez-utils: bluetoothctl, rfcomm
@ctlllll
ctlllll / longest_chinese_tokens_gpt4o.py
Created May 13, 2024 19:53
Longest Chinese tokens in gpt4o
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except:
@liamdawson
liamdawson / com.ldaws.CapslockEsc.plist
Last active May 15, 2024 07:00
Caps Lock -> Esc on macos
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Place in ~/Library/LaunchAgents/ -->
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.ldaws.CapslockEsc</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
defmodule Mix.Tasks.ConvertToVerifiedRoutes do
@moduledoc """
Replaces routes with verified routes.
Forked from
https://gist.github.com/andreaseriksson/e454b9244a734310d4ab74d8595f98cd
This requires all routes to consistently be aliased with
alias MyAppWeb.Router.Helpers, as: Routes
Run with
@vindarel
vindarel / common-lisp-VS-clojure.md
Last active May 15, 2024 06:55
Notes on Common Lisp VS Clojure

Testimonies

CL's compiler

The thing in CL I miss most doing Clojure as my day job? CL's compiler. I like having a compiler tell me at compile time about the mistakes I've made. Bogus arguments. Unreachable code because of unhandled exceptions, and so on. CL saves me round after round of bugs that in clojure aren't found until you run the code. If you test well, it's found when testing, if you don't it's found in production. "Clojure compiler" almost demands air quotes.

CL's optional but oh-so-useful model of type declarations is also infinitely more useful (to me) than Clojure's use of "spec", and instrumentation that happens only at test time because of the cost. Depending on the OPTIMIZE declarations, other type defs are a floor wax and dessert topping. Want checks for argument types? Lower optimizations. Want most efficient machine code? High optimizations.

/u/Decweb, March 2023 https://www.reddit.com/r/lisp/comments/11ttnxk/the_rise_fall_of_lisp_too_good_for_the_rest_of/jczpysp/