Skip to content

Instantly share code, notes, and snippets.

View JamesHopbourn's full-sized avatar

James Hopbourn JamesHopbourn

View GitHub Profile
@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
@JamesHopbourn
JamesHopbourn / .meta.xml
Last active December 19, 2023 18:06 — forked from JoJoJotarou/.meta.xml
IDEA MybatisX template (1. 自定义 controller 模板 2. mapperInterface 添加 @Mapper 注解)
<?xml version="1.0" encoding="utf-8" ?>
<templates>
<template>
<property name="configName" value="serviceInterface"/>
<property name="configFile" value="serviceInterface.ftl"/>
<property name="fileName" value="${domain.fileName}Service"/>
<property name="suffix" value=".java"/>
<property name="packageName" value="${domain.basePackage}.service"/>
<property name="encoding" value="${domain.encoding}"/>
<property name="basePath" value="${domain.basePath}"/>
import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.personal.Result;
import com.example.personal.entity.Person;
import com.example.personal.service.PersonService;
import org.apache.commons.io.IOUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@JamesHopbourn
JamesHopbourn / TelegramCloudflareWorkerBot.js
Created November 26, 2023 07:08
Telegram Bot 添加 Todoist 任务
addEventListener('fetch', (event) => {
event.respondWith(handleRequest(event.request));
});
const TodoistToken = "";
const TelegramChannelLink = 'https://t.me/c/xxxxxxxxxx'
async function handleRequest(request) {
try {
const data = await request.json();
const juejin = /https:\/\/link.juejin.cn\/\?target=(.*)/;
const oldurl = $request.url;
let newurl = "";
if (oldurl.indexOf("link.juejin.cn/?target") != -1){
newurl = decodeURIComponent(juejin.exec(oldurl)[1]);
}
newurl = newurl.indexOf("http") == 0 ? newurl : "http://" + newurl;
@JamesHopbourn
JamesHopbourn / BitAPI.py
Created December 20, 2022 13:26
python对接比特
"""
@Author: 小样
@Date: 2022-10-30
@UpdateDate: 2022-12-20
@wechat: mz-cyx
@description: 比特浏览器API接口
@version: 1.0
@AD: 专业定制外网自动化程序,Twitter、Facebook、Tiktok、Instagram、Google等等自动化工具;
所有本人定制软件均使用自改undetected_chromedriver,可过nowsecure.nl
@JamesHopbourn
JamesHopbourn / BitAPI.py
Created December 20, 2022 13:26
python对接比特
"""
@Author: 小样
@Date: 2022-10-30
@UpdateDate: 2022-12-20
@wechat: mz-cyx
@description: 比特浏览器API接口
@version: 1.0
@AD: 专业定制外网自动化程序,Twitter、Facebook、Tiktok、Instagram、Google等等自动化工具;
所有本人定制软件均使用自改undetected_chromedriver,可过nowsecure.nl