Skip to content

Instantly share code, notes, and snippets.

View JamesHopbourn's full-sized avatar

James Hopbourn JamesHopbourn

View GitHub Profile

imgcopy & imgpaste

通过命令行复制与粘贴图片到 macOS 剪贴板的 Swift 工具集。

项目简介

本项目提供两个 Swift 编写的 CLI 工具:

  • imgcopy:将图片文件或标准输入的图像数据复制到系统剪贴板。
  • imgpaste:从系统剪贴板中获取图像数据并以数据流的形式输出。
@JamesHopbourn
JamesHopbourn / download-mavericks.sh
Created March 13, 2025 13:47 — forked from Wowfunhappy/download-mavericks.sh
Download a Mac OS X 10.9 Mavericks installer image Apple
#!/bin/bash
#!/bin/sh
# Download script written by Wowfunhappy. Last updated 2025/03/07.
# Thank you to Krackers, Jazzzny, and others for helping analyze Apple's download process and debug this script.
# Thank you to dosdude1 for donating identifiers from a broken Mac.
# Any mistakes are mine alone.
BOARD_SERIAL_NUMBER="C0243070168G3M91F"
@JamesHopbourn
JamesHopbourn / mavericks-iso.sh
Created March 13, 2025 13:05 — forked from josephabrahams/mavericks-iso.sh
Create a bootable ISO from the OS X Mavericks app
#!/bin/sh
# Create a bootable ISO from the OS X Mavericks app
# http://thezinx.com/misc/trend/create-bootable-dmg-iso-mavericks-app/
if [ ! -f /Applications/Install\ OS\ X\ Mavericks.app/Contents/SharedSupport/InstallESD.dmg ]; then
echo "Download the OS X Mavericks App and then rerun this script."
open "https://itunes.apple.com/us/app/os-x-mavericks/id675248567"
exit 1
fi
@JamesHopbourn
JamesHopbourn / install-coreutils-from-src-mac
Created February 4, 2025 03:48 — forked from byronmansfield/install-coreutils-from-src-mac
Install coreutils from source Mac OS X
# Install coreutils from source on Mac OS X
# prepare workspace
mkdir -p ~/code/build-from-src/ && cd $_
# download source code
curl -LO https://ftp.gnu.org/gnu/coreutils/coreutils-8.31.tar.xz
# expand
tar -xJvf coreutils-8.31.tar.xz
@JamesHopbourn
JamesHopbourn / git-ssh-error-fix.sh
Created January 22, 2025 03:06 — forked from Tamal/git-ssh-error-fix.sh
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone [email protected]:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T [email protected]
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
@JamesHopbourn
JamesHopbourn / Adblock Simple.js
Created April 14, 2024 03:28 — forked from kbauer/Adblock Simple.js
A simple adblocker bookmarklet, removing suspicious iframes. To install, copy-paste the source to a bookmark (will automatically remove newline characters). Extend the array ``exceptOrigins`` in order to create new exceptions. Careful: If bookmarklets get too long, they might stop working. This methods provides on-demand adblocking (as opposed t…
javascript:/* Adblock Simple */
(function(){
const exceptOrigins = [
'https://disqus.com',
document.origin
];
function remIF(e){
try{
var orgn = new URL(e.src || 'http://unknown-src').origin;

Copy ChatGPT Transcript as markdown

javascript:void (async () => { let { default: TD } = await import("https://cdn.skypack.dev/turndown");  let json = [   ...document.querySelectorAll(".text-base"), ].map((i) => ({   html: i.innerHTML,   text: i.innerText,   markdown: new TD().turndown(i),   isPrompt: !i.querySelector(".prose"), }));  window.open(   URL.createObjectURL(     new Blob(       [         json           .map((i) =>             i.isPrompt ? `**Prompt**: ${i.text}` : `**ChatGPT**: ${i.markdown}`           )           .join("\n\n"),       ],       { type: "text/plain" }     )   ) ); })()

Google answer

Get a quick answer from google for any question

(async function answer(q) {
  var html = await fetch(
    `https://cors.explosionscratc.repl.co/google.com/search?q=${encodeURI(q)}`,

01 背包二维数组实现

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int row = sc.nextInt();
        int col = sc.nextInt();
total 3896
lrwxr-xr-x 1 root wheel 68 12 15 06:43 apfs_hfs_convert -> ../System/Library/Filesystems/apfs.fs/Contents/Resources/hfs_convert
-rwxr-xr-x 1 root wheel 187424 12 15 06:43 apfs_unlockfv
-rwxr-xr-x 1 root wheel 153664 12 15 06:43 disklabel
-rwxr-xr-x 1 root wheel 133936 12 15 06:43 dmesg
-rwxr-xr-x 1 root wheel 135088 12 15 06:43 dynamic_pager
-rwxr-xr-x 1 root wheel 205328 12 15 06:43 fibreconfig
-r-xr-xr-x 1 root wheel 135312 12 15 06:43 fsck
lrwxr-xr-x 1 root wheel 66 12 15 06:43 fsck_apfs -> ../System/Library/Filesystems/apfs.fs/Contents/Resources/fsck_apfs
-rwxr-xr-x 1 root wheel 374960 12 15 06:43 fsck_cs