Skip to content

Instantly share code, notes, and snippets.

@aolyang
aolyang / eslint.config.mjs
Last active November 6, 2024 23:42
config vue3 eslint use "eslint9.x flat config" feature
import { builtinModules } from "module"
import { fixupConfigRules } from "@eslint/compat"
import jsLint from "@eslint/js"
import stylistic from "@stylistic/eslint-plugin"
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js"
import pluginSimpleImportSort from "eslint-plugin-simple-import-sort"
import vueLint from "eslint-plugin-vue"
import globals from "globals"
import tsLint from "typescript-eslint"
@sorend
sorend / Update firwmware WD Black SN770 firmware on Arch Linux.md
Last active November 6, 2024 23:40
Update firmware WD Black SN770 firmware on Arch Linux

Update firmware WD Black SN770 firmware on Arch Linux

Been having problems with my new SN770 drive, and decided to check if I can firmware update it on Linux. WD only provides a Windows tool, Western Digital Dashboard to download and install firmwares, but, it's possible to find the firmware and install it using Linux tooling as well.

1. Check that nvme-cli is installed:

❱ sudo pacman -S nvme-cli
@natelandau
natelandau / .bash_profile
Last active November 6, 2024 23:39
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@rodrwan
rodrwan / binary-tree.js
Last active November 6, 2024 23:28
Implementación árbol binario en JavaScript
class Node {
constructor (value) {
this.value = value
this.right = null
this.left = null
}
}
class Tree {
constructor () {
@santaklouse
santaklouse / CrossOver.sh
Last active November 6, 2024 23:27
unlimited CrossOver trial (MacOS)
#!/usr/bin/env bash
# checck if pidof exists
PIDOF="$(which pidof)"
# and if not - install it
(test "${PIDOF}" && test -f "${PIDOF}") || brew install pidof
# find app in default paths
CO_PWD=~/Applications/CrossOver.app/Contents/MacOS
test -d "${CO_PWD}" || CO_PWD=/Applications/CrossOver.app/Contents/MacOS
@dmorosinotto
dmorosinotto / base.component.ts
Last active November 6, 2024 23:26
Angular BaseComponent with handle destroy$ and takeUntil pattern to unsubscribe!
import { Directive, OnDestroy } from "@angular/core";
import { Subject } from "rxjs";
import { takeUntil } from "rxjs/operators";
@Directive() // Needed only for Angular v9+ strict mode that enforce decorator to enable Component inheritance
export abstract class BaseComponent implements OnDestroy {
// _destroy$ is LAZY: it'll be created (and allocate memory) only if you use takeUntilDestroy
private _destroy$?: Subject<void>;
protected takeUntilDestroy = <T>() => {
if (!this._destroy$) this._destroy$ = new Subject<void>(); // LAZY Subject
@ksasao
ksasao / TextAssistant.ino
Created November 6, 2024 13:55
M5Stack LLM Module で日本語対話 https://x.com/ksasao/status/1854157588247806342 #M5StackLLM
/*
* SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
* SPDX-License-Identifier: MIT
* M5Stack LLM Module で日本語対話。Serial MonitorでBoth BL&CRを設定するとよいです。
*/
#include <Arduino.h>
#include <M5Unified.h>
#include <M5ModuleLLM.h>
M5ModuleLLM module_llm;
@thr0wn
thr0wn / mandelbrot.py
Last active November 6, 2024 23:22
Mandelbrot set generated using python turtle
import turtle
import math
def mandelbrot(z , c , n=20):
if abs(z) > 10 ** 12:
return float("nan")
elif n > 0:
return mandelbrot(z ** 2 + c, c, n - 1)
else:
return z ** 2 + c
@Aneureka
Aneureka / sync-from-chrome-to-safari
Last active November 6, 2024 23:18
An apple script to sync history, bookmarks & passwords from google chrome to safari.
# Add a scheduled sync task at 4:00 am
# Some privileges should be granted to `cron` *manually*, so you may test `* * * * *` (run every second) first to grant the needed privileges in advance
0 4 * * * osascript /path/to/your/sync-from-chrome-to-safari.scpt