Skip to content

Instantly share code, notes, and snippets.

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

luo jiyin luojiyin1987

💭
I may be slow to respond.
View GitHub Profile
#include "PainterEngine.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <immintrin.h>
#define ALPHABET_SIZE 256
#define MAX_PATTERN_LEN 1024
@hemashushu
hemashushu / configuration.nix
Created May 5, 2025 15:05
NixOS configuration reference 2025-05
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, lib, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
@hylarucoder
hylarucoder / main.go
Created November 27, 2024 03:33
golang serve media dir
package main
import (
"log"
"net/http"
)
func main() {
// Create file server handler
fs := http.FileServer(http.Dir("./media"))
@abersheeran
abersheeran / llama2-2-7b-chat-int8-worker.js
Last active January 18, 2025 09:07
llama2-2-7b-chat-int8 in Cloudflare workers
import { Ai } from './vendor/@cloudflare/ai.js';
export default {
async fetch(request, env) {
const ai = new Ai(env.AI);
// prompt - simple completion style input
// let simple = {
// prompt: 'Tell me a joke about Cloudflare'
// };
@haixinsong
haixinsong / trans.py
Created September 5, 2022 14:32
simple file encode trans python tool
from os import listdir
from os import walk
from os.path import isfile,isdir,join
from chardet.universaldetector import UniversalDetector
# may need to `pip3 install chardet`
import codecs
detector = UniversalDetector()
# change the targetPath to your path
@Victrid
Victrid / gitgraft.sh
Created August 29, 2022 17:09
Find which commit your no-git friend is working on and generate patches for attaching their works onto git tree.
#!/bin/bash
hash git 2>/dev/null || { echo >&2 "Required command 'git' is not installed. ( hmm... why are you using this? ) Aborting."; exit 1; }
hash realpath 2>/dev/null || { echo >&2 "Required command 'realpath' is not installed. Aborting."; exit 1; }
hash pwd 2>/dev/null || { echo >&2 "Required command 'pwd' is not installed. Aborting."; exit 1; }
hash cd 2>/dev/null || { echo >&2 "Required command 'cd' is not installed. Aborting."; exit 1; }
hash echo 2>/dev/null || { echo >&2 "Required command 'echo' is not installed. Aborting."; exit 1; }
hash mv 2>/dev/null || { echo >&2 "Required command 'mv' is not installed. Aborting."; exit 1; }
hash diff 2>/dev/null || { echo >&2 "Required command 'diff' is not installed. Aborting."; exit 1; }
hash diffstat 2>/dev/null || { echo >&2 "Required command 'diffstat' is not installed. Aborting."; exit 1; }
@lexrus
lexrus / delete_all_imessage_conversations.applescript
Last active January 26, 2024 16:12
Delete all iMessage conversations. Compatible with macOS Monterey. Please check Reduce motion before launch this apple script.
# System Preferences -> Accessibility -> Display -> Reduce motion
tell application "Messages" to activate
tell application "Messages"
set chatCount to (count of chats)
end tell
tell application "System Events"
tell process "Messages"
// ==UserScript==
// @name Hide bilibili video popup
// @namespace http://tampermonkey.net/
// @version 0.1
// @description hide annoying pop up choices.
// @author laixintao
// @match https://www.bilibili.com/*
// @icon https://www.google.com/s2/favicons?domain=bilibili.com
// @grant GM_addStyle
// ==/UserScript==
# HG changeset patch
# User Dmitry Volyntsev <[email protected]>
# Date 1632256177 0
# Tue Sep 21 20:29:37 2021 +0000
# Node ID cc2b995738cdad13144ced7bfcd316475c14a049
# Parent 6feba0e602eeaa963aaf878dc6aa84b8ce2a668e
Introduced WebCrypto API according to W3C spec.
The following methods were implemented:
crypto.getRandomValues()
@soulteary
soulteary / gitea-docker-restore.sh
Last active April 4, 2021 02:35
Gitea data restore script (docker)
#!/bin/sh
# Gitea data restore script (docker)
# Usage: ./restore.sh gitea-dump-1617385736.zip DockerIdOrDockerName
BACKUP_FILE=$1
CONTAINER_NAME=$2
if [ -f "$BACKUP_FILE" ]; then
if [ ! -z "$CONTAINER_NAME" -a "$CONTAINER_NAME" != " " ]; then
docker cp $BACKUP_FILE $CONTAINER_NAME:/tmp