Skip to content

Instantly share code, notes, and snippets.

@bmaupin
bmaupin / free-database-hosting.md
Last active May 4, 2024 14:38
Free database hosting
@ibireme
ibireme / kpc_demo.c
Last active May 4, 2024 14:37
A demo shows how to read Intel or Apple M1 CPU performance counter in macOS.
// =============================================================================
// XNU kperf/kpc demo
// Available for 64-bit Intel/Apple Silicon, macOS/iOS, with root privileges
//
//
// Demo 1 (profile a function in current thread):
// 1. Open directory '/usr/share/kpep/', find your CPU PMC database.
// M1 (Pro/Max/Ultra): /usr/share/kpep/a14.plist
// M2 (Pro/Max): /usr/share/kpep/a15.plist
// M3: /usr/share/kpep/as1.plist
@shunchu
shunchu / convert-seconds-into-hh-mm-ss-in-ruby.rb
Created July 25, 2012 07:58
Convert seconds into HH:MM:SS in Ruby
t = 236 # seconds
Time.at(t).utc.strftime("%H:%M:%S")
=> "00:03:56"
# Reference
# http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time
@kyo-takano
kyo-takano / making-the-most-of-local-llms.ipynb
Last active May 4, 2024 14:36
ローカルLLMはこーやって使うの💢
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@irazasyed
irazasyed / outbound-email-with-cloudflare.md
Last active May 4, 2024 14:33
Using Gmail SMTP with Cloudflare Email Routing: A Step-by-Step Guide

Using Gmail SMTP with Cloudflare Email Routing: Step-by-Step Guide

Learn how to send emails through Gmail SMTP with Cloudflare Email Routing in this comprehensive guide.

Step 1: Enable 2-Factor Authentication

To proceed with this method, ensure that you have enabled two-factor authentication for your Google account. If you haven't done so already, you can follow the link to set it up → Enable 2FA in your Google account.

Step 2: Create an App Password for Mail

@bradtraversy
bradtraversy / docker-help.md
Last active May 4, 2024 14:32
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

// ranker is a helper type for the rank function.
type ranker struct {
f []float64 // Data to be ranked.
r []int // A list of indexes into f that reflects rank order after sorting.
}
// ranker satisfies the sort.Interface without mutating the reference slice, f.
func (r ranker) Len() int { return len(r.f) }
func (r ranker) Less(i, j int) bool { return r.f[r.r[i]] < r.f[r.r[j]] }
func (r ranker) Swap(i, j int) { r.r[i], r.r[j] = r.r[j], r.r[i] }
@juanbrujo
juanbrujo / PlayStationBIOSFilesNAEUJP.md
Last active May 4, 2024 14:31
Files for PlayStation BIOS Files NA-EU-JP
@tykurtz
tykurtz / grokking_to_leetcode.md
Last active May 4, 2024 14:32
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@shaundon
shaundon / WorkoutSplit.swift
Created February 21, 2021 17:34
Convert an array of HKQuantitySample into splits.
import Foundation
import HealthKit
struct WorkoutSplit: Hashable {
let label: String
let distance: HKQuantity
let duration: TimeInterval
}
extension WorkoutSplit {