Skip to content

Instantly share code, notes, and snippets.

@programus
programus / impbcopy.m
Last active November 7, 2022 09:02 — forked from yuchuanfeng/impbcopy.m
Command line copy an image file to the clipboard in Mac OS X. See first comment for install instructions.
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <unistd.h>
BOOL copy_to_clipboard(NSString *path)
{
// http://stackoverflow.com/questions/2681630/how-to-read-png-image-to-nsimage
NSImage * image;
if([path isEqualToString:@"-"])
{
// http://caiustheory.com/read-standard-input-using-objective-c
{
"urls": [
{
"url": "https://raw.githubusercontent.com/qist/tvbox/master/jsm.json"
"name": "TV"
},
{
"url": "http://我不是.肥猫.love:63/接口禁止贩卖",
"name": "🚀肥猫线路"
},
@programus
programus / id.ts
Last active May 15, 2025 09:10
TypeScript function to identify references of everything
// check whether the object is the same reference
// from https://stackoverflow.com/a/43963612/1166461
export const id = (() => {
const useless = typeof (1 as any)
let currentId = 0
const map = new WeakMap()
type ResultType = number|bigint|string|boolean|undefined
const objId = <T extends object>(obj: T): ResultType => {