Skip to content

Instantly share code, notes, and snippets.

View merrickluo's full-sized avatar
💭
I may be slow to respond.

Merrick Luo merrickluo

💭
I may be slow to respond.
View GitHub Profile
From d6729f5621abbf374a371dd6fdaa13d7dd209468 Mon Sep 17 00:00:00 2001
From: Merrick Luo <merrick@luois.me>
Date: Sun, 14 Jan 2024 19:02:47 +0800
Subject: [PATCH] Make line spacing centered
---
src/xdisp.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/xdisp.c b/src/xdisp.c
@merrickluo
merrickluo / gptel-copilot.el
Last active January 10, 2024 14:27
use copilot as gptel backend
;;; copilot.el --- copilot backend for gptel -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Merrick Luo
;;
;; Author: Merrick Luo <merrick@luois.me>
;; Maintainer: Merrick Luo <merrick@luois.me>
;; Created: January 10, 2024
;; Modified: January 10, 2024
;; Version: 0.0.1
;; Keywords: comm
@merrickluo
merrickluo / copilot-openai.py
Last active January 10, 2024 11:15
proxy openai request with copilot
#!/usr/bin/env python3
## Copilot OpenAI Proxy
## A http server that proxies openai requests to copilot by adding required headers
## Copilot cli must be installed and logged in
## Inspired by https://github.com/aaamoon/copilot-gpt4-service
##
## only external dependency is requests, cuz http.client is shit, so as http.server
import json
(use-package consult-notes
:commands (consult-notes
consult-notes-org-roam-find-node
consult-notes-org-roam-find-node-relation)
:config
(consult-notes-org-roam-mode))
(after! org-agenda
(use-package! org-roam
(ns day18
(:require [clojure.pprint :refer [pprint]]
[clojure.zip :as z]))
(defn exp-left [sn n]
(loop [t (z/prev sn) l 1]
(if (nil? t)
sn
(let [tn (z/node t)]
(if (number? tn)
@merrickluo
merrickluo / config.el
Created September 8, 2021 15:05
typescript-mode + tree-sitter for tsx
(use-package! tree-sitter
:when (bound-and-true-p module-file-suffix)
:hook (prog-mode . tree-sitter-mode)
:hook (tree-sitter-after-on . tree-sitter-hl-mode)
:config
(require 'tree-sitter-langs)
(global-tree-sitter-mode)
(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)
(defadvice! doom-tree-sitter-fail-gracefully-a (orig-fn &rest args)
"Don't break with errors when current major mode lacks tree-sitter support."
@merrickluo
merrickluo / bingwall
Created August 9, 2021 11:46
bash script to fetch bingwallpaper
#!/usr/bin/env bash
resolution=3840
api="https://bing.biturl.top/?resolution=$resolution"
store="$HOME/Pictures/Bing"
mkdir -p $store
img_url=`curl -s $api | jq -r .url`
img_name=${img_url##*=}
addEventListener("fetch", (event) => {
event.respondWith(
handleRequest(event).catch(
(err) => new Response(err.stack, { status: 500 })
)
);
});
/**
* Many more examples available at:
@merrickluo
merrickluo / Dockerfile
Created August 10, 2020 02:07
jenkins alpine docker
FROM jenkins/jenkins:lts-alpine
ARG DOCKER_CLI_VERSION="19.03.9"
ENV DOWNLOAD_URL="https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_CLI_VERSION.tgz"
USER root
# install docker client
RUN mkdir -p /tmp/download \
&& curl -L $DOWNLOAD_URL | tar -xz -C /tmp/download \ && mv /tmp/download/docker/docker /usr/local/bin/ \
&& rm -rf /tmp/download \ USER ${user}
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.6.15-zen2-1-zen] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Desktop SSHD
Device Model: ST1000DX001-1CM162
Serial Number: *
LU WWN Device Id: 5 000c50 079d815a2
Firmware Version: CC43
User Capacity: 1,000,204,886,016 bytes [1.00 TB]