Skip to content

Instantly share code, notes, and snippets.

View hoyangtsai's full-sized avatar
⌨️
Prompting

Hoyang Tsai hoyangtsai

⌨️
Prompting
View GitHub Profile
@hoyangtsai
hoyangtsai / dogemine.sh
Created May 1, 2021 09:39
doge mining via unmineable with xmrig
#!/bin/sh
./xmrig -o rx.unmineable.com:3333 -a rx -k -u DOGE:D9PtRabmsETDR1jxYpdwogNDsiqL3RY7Bo.dogeminer1 --thread 6
@hoyangtsai
hoyangtsai / xmrmine.sh
Last active May 1, 2021 09:38
xmr mining via pool.minexmr.com with xmrig
#!/bin/sh
./xmrig -o pool.minexmr.com:4444 -u 84GBkwYDmat1PXdpY9rfoNLdxeXYvWwTYeJnwQd5L26FUSofuWnExGw3Sq7FuAG5qzDzGNosPegs5h6AiRJV8oGSRfjvwUE --threads 6
@hoyangtsai
hoyangtsai / ToInteger.js
Last active December 27, 2021 06:15
convert a array of numeric strings to primitive numbers
['1', '3', '5', '7', '9'].map(Number); // [1, 3, 5, 7, 9]
@hoyangtsai
hoyangtsai / async-child.sh
Last active December 27, 2021 06:42
async shell script #shellscript
#!/bin/bash
#
# 异步执行(wait)使用样例-子脚本
#
echo "子脚本:正在运行.."
sleep 5
echo "子脚本:子脚本结束。脚本退出!"
@hoyangtsai
hoyangtsai / string.js
Last active December 31, 2021 03:32
string first character uppercase
const capitalize = (s) => {
if (typeof s !== 'string') return ''
return s.charAt(0).toUpperCase() + s.slice(1)
}
// OR
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1)
}
@hoyangtsai
hoyangtsai / scrollToEl.js
Created August 18, 2020 09:36 — forked from benhatsor/scrollToEl.js
Smooth scroll to element - Pure JS
function scrollToEl(el) {
var rect = el.getBoundingClientRect(),
scrollTop = window.pageYOffset || document.documentElement.scrollTop,
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
elTop = rect.top + scrollTop,
elLeft = rect.left + scrollLeft;
window.scrollTo({
top: elTop,
left: elLeft,
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@hoyangtsai
hoyangtsai / url.js
Created July 17, 2020 16:18
url query concat
const urlConcat = (url, append) => {
if (url) {
const uq = url.split('?');
const origin = uq[0];
const query = (uq[1] ? uq[1].split('&') : []).concat(append).join('&');
return `${origin}?${query}`;
}
return '';
};
@hoyangtsai
hoyangtsai / index.html
Last active December 27, 2021 06:55
javascript working with server side include #snippet #SSI
<script type="text/javascript">
var config1 = <!--#include virtual="/server/path/to/config1.js" -->
var config2 = <!--#include virtual="/server/path/to/config2.js" -->
</script>
@hoyangtsai
hoyangtsai / viewer.vue
Created July 2, 2020 04:12
pdf.js render
<template>
<iframe
:src="fileSrc"
ref="viewFrame">
</iframe>
</template>
<script>
import axios from 'axios';
import pdfjs from 'pdfjs-dist';