Skip to content

Instantly share code, notes, and snippets.

@fxp
fxp / create_macos_media.sh
Created March 13, 2024 03:06
create macos usb installation disk
sudo /Applications/Install\ macOS\ [Monterey].app/Contents/Resources/createinstallmedia --volume /Volumes/[USBKEY]
@fxp
fxp / install_clashx.md
Last active March 13, 2024 03:03
Download and install clashX
@fxp
fxp / downloadall.js
Created April 22, 2021 16:02
Download all albumns from hentaiser homepage
const fetch = require('node-fetch-with-proxy');
const fs = require('fs');
const path = require('path');
async function getAlbumnList(type) {
let result = await fetch("https://api.hentaiser.com/1.2/books/" + type, {
"headers": {
"accept": "*/*",
"content-type": "application/json",
"origin": "https://app.hentaiser.com",
@fxp
fxp / gen_bar_code.js
Created December 27, 2020 06:39
generate bar code
const bwipjs = require('bwip-js');
const fs = require('fs');
async function genImgs() {
for (let i = 1; i < 500 ; i++) {
const stream = fs.createWriteStream("./" + i + ".png");
let buf = await bwipjs.toBuffer({
bcid: 'code128',
text: '' + i,
@fxp
fxp / test.html
Created March 23, 2019 00:35
Media audio availability test
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<!--<script src="https://unpkg.com/wavesurfer.js"></script>-->
</head>
<body>
<video id="video"
@fxp
fxp / last_element.js
Created September 13, 2018 13:21
Select the last element of a array
var arr = [1,2,3,4];
var last = arr.slice(-1)[0];
console.log(last);
@fxp
fxp / timeoutPromise.js
Created September 13, 2018 08:35
Timeout promise version and usage
function promiseTimeout(time) {
return new Promise((resolve, reject) => {
setTimeout(() => reject('timeout'), time);
});
};
let promiseB = new Promise((resolve, reject) => {
setTimeout(() => {
reject('Promise win!');
}, 400)
@fxp
fxp / gist:fe42cdbc07790bbad220e3825d2d230f
Created August 10, 2018 01:54
通过APT-GET安装nodejs被墙
# 问题
有时候会链接不到deb.nodesource.com,造成无法通过包管理安装nodejs。用Lantern的全局流量代理好像无法重定向apt-get的流量。
# 解决方案
sudo http_proxy="http://127.0.0.1:xxxx" apt-get install nodejs
@fxp
fxp / install_teamcity_ubuntu16
Last active June 22, 2017 09:41
Install Teamcity
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
// Download teamcity file
// https://download-cf.jetbrains.com/teamcity/TeamCity-2017.1.2.tar.gz
// https://download-cf.jetbrains.com/charisma/youtrack-2017.2.33766.jar
@fxp
fxp / npm_mirror_taobao.sh
Created May 25, 2017 08:52
Change npm repo to taobao mirror
npm config set registry https://registry.npm.taobao.org