Skip to content

Instantly share code, notes, and snippets.

View gatspy's full-sized avatar

CG.gatspy gatspy

View GitHub Profile
@renevdzee
renevdzee / DuckDB.json
Last active April 16, 2025 16:24
DuckDB Windows Terminal Profile
{
"profiles": [
{
"commandline": "%ProgramFiles%\\DuckDB\\duckdb.exe -cmd .utf8 -cmd \".prompt '\ud83e\udd86 ' '.. '\" -cmd \".print DuckDB\"",
"guid": "{a6596808-443b-47e8-92b5-afffb4256702}",
"hidden": false,
"icon": "%ProgramFiles%\\DuckDB\\DuckDB.exe,0",
"name": "DuckDB",
"showMarksOnScrollbar": true,
"autoMarkPrompts": true,
@garg-aayush
garg-aayush / Steps_multiple_cuda_environments.md
Last active April 22, 2025 07:55
Managing multiple CUDA versions using environment modules in Ubuntu

Steps to manage multiple CUDA environments

Latest Update: May 19th, 2024

This gist contains all the steps required to:

  • Install multiple CUDA versions (e.g., CUDA 11.8 and CUDA 12.1
  • Manage multiple CUDA environments on Ubuntu using the utility called environment modules.
  • Use this approach to avoid CUDA environment conflicts.

Environment Modules is a package that provides for the dynamic modification of a user's environment via modulefiles. You can find more on it at https://modules.readthedocs.io/en/latest/

@pmbaumgartner
pmbaumgartner / cloud-init.yaml
Last active February 28, 2025 09:17
Multipass & Docker Setup
#cloud-config
package_upgrade: true
ssh_authorized_keys:
- <your key>
packages:
- apt-transport-https
- ca-certificates
- curl
@shirakaba
shirakaba / README.md
Last active March 27, 2025 15:25
GUI-based debugging of iOS/macOS Rust projects in Xcode

Here's how to get your environment set up to:

  1. Develop iOS and Android apps using Rust.
  2. Enable GUI debugging of Rust projects in Xcode.

If you just want to enable GUI debugging of macOS Rust projects in Xcode, I'm not actually sure whether you need cargo-mobile at all. But one benefit of installing it is that it automatically installs rust-xcode-plugin for you, giving you syntax highlighting of Rust sources in Xcode.

Prerequisites

cargo-mobile

@gmk57
gmk57 / CoroutineTimer.kt
Last active September 16, 2024 13:55
Coroutine-based solution for delayed and periodic work
/**
* Coroutine-based solution for delayed and periodic work. May fire once (if [interval] omitted)
* or periodically ([startDelay] defaults to [interval] in this case), replacing both
* `Observable.timer()` & `Observable.interval()` from RxJava.
*
* In contrast to RxJava, intervals are calculated since previous run completion; this is more
* convenient for potentially long work (prevents overlapping) and does not suffer from queueing
* multiple invocations in Doze mode on Android.
*
* Dispatcher is inherited from scope, may be overridden via [context] parameter.
//
// ContentView.swift
// Moon
//
// Created by Tanner W. Stokes on 8/9/20.
//
import SwiftUI
struct ContentView: View {
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active April 25, 2025 01:50
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@rnyrnyrny
rnyrnyrny / logger.go
Last active April 8, 2025 19:40
log using uber zap and lumberjack
// NOTE
// This gist was created long time ago.
// According to zap's doc, now we can use zapcore.AddSync to directly add lumberjack as a zap sync
// see https://github.com/uber-go/zap/blob/master/FAQ.md#does-zap-support-log-rotation
// So I wrote a new gist if anyone is interested:
// https://gist.github.com/rnyrnyrny/a6dc926ae11951b753ecd66c00695397
// 下面的代码已经过时了,现在直接用zapcore.AddSync就行,参考zap文档
// thanks to:
@chibatching
chibatching / FlowThrottleDebounce.kt
Last active November 8, 2024 00:44
Throttle and Debounce on Flow Kotlin Coroutines
fun <T> Flow<T>.throttle(waitMillis: Int) = flow {
coroutineScope {
val context = coroutineContext
var nextMillis = 0L
var delayPost: Deferred<Unit>? = null
collect {
val current = SystemClock.uptimeMillis()
if (nextMillis < current) {
nextMillis = current + waitMillis
@nihlton
nihlton / persisted-timeboxed-redux-store.js
Last active July 2, 2020 13:50
Persist Redux in localStorage, with an expiration schedule for each store key.
import { getInitialState, syncLocalStorageWithRedux } from './util-localStorage'
const reduxStorageKey = 'my-application:'
const ONE_SECOND = 1000
const ONE_MINUTE = ONE_SECOND * 60
const ONE_HOUR = ONE_MINUTE * 60
const ONE_DAY = ONE_HOUR * 24
const ONE_YEAR = ONE_DAY * 365
// create a white list. key is the redux store key, and lifeSpan is