Skip to content

Instantly share code, notes, and snippets.

View temberature's full-sized avatar

Tong temberature

  • USA
View GitHub Profile
@temberature
temberature / removeB.js
Created April 12, 2019 09:28
replace <b>text</b> with text
document.querySelectorAll('b').forEach(element=>{
// element.parentNode.replaceChild(document.createTextNode(element.innerText), element)
console.log(element)
if (element.parentNode && element.parentNode.innerText) {
element.parentNode.innerHTML = element.parentNode.innerText
}
}
)
@temberature
temberature / gist:4f986ef049f938a3402784026d9deea7
Last active July 3, 2019 07:00
JS 选择所有包含某个字符的 id
document.querySelectorAll('[id*=block]')
Array.apply(null, document.querySelectorAll('[id]')).map(item => item.getAttribute('id')).filter(item => item.includes('block'))
idlePrefetch (originImageUrl) {
let fetched = false;
let myNonEssentialWork = deadline => {
const appendLinkTo = function (url) {
const linkTag = document.createElement('link')
linkTag.rel = 'prefetch'
linkTag.href = url
document.head.appendChild(linkTag)
}
if (deadline.timeRemaining() > 0) {
#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
src="/volume1/homes/1605259395"
dst="/volume1/books"
echo $src
function read_dir() {
for file in $(#
ls $1
import System;
import System.Windows.Forms;
import Fiddler;
// INTRODUCTION
//
// Well, hello there!
//
// Don't be scared! :-)
//
version: "2.1"
networks:
internal_network:
services:
db:
restart: always
networks:
- internal_network
build: ./MongoDB/
environment:
@temberature
temberature / burner.sh
Created November 5, 2019 08:06
move file one by one
#!/usr/bin/env bash
## This is the target path, the directory
## you want to copy to.
target=$2;
## Find all files and folders in the current directory, sort
## them reverse alphabetically and iterate through them
find $1 -maxdepth 1 -type f | sort -r | while IFS= read -r file; do
## Set the counter back to 0 for each file
counter=0;
(function () {
const ea = window.ExcalidrawAutomate;
ea.onDropHook = async function (data) {
console.log(data);
if (
data.payload.text &&
data.payload.text.substring(0, 11) == "obsidian://"
) {
ea.reset();
import { PDFDocument, StandardFonts, rgb } from "pdf-lib";
import fs from "fs";
import fontkit from "@pdf-lib/fontkit";
// Create a new PDFDocument
const pdfDoc = await PDFDocument.create();
// var font = fontkit.openSync('fonts/msyh.ttf');
const fontData = fs.readFileSync("fonts/msyh.ttf");
pdfDoc.registerFontkit(fontkit);