This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(async()=>{const url=location.href;const[,tweetId,nth]=url.match(/\/status\/(\d+)\/photo\/(\d)/);const modal=document.querySelector('div[style*="transition-duration:"][style*="background-color:"]');const ul=[...modal.querySelectorAll("ul")].find(elm=>[...elm.style].includes("transform"));const imgQuery='img[src^="https://pbs.twimg.com/media/"]';const img=ul!==undefined?[...ul.querySelectorAll(imgQuery)][nth-1]:[...modal.querySelectorAll(imgQuery)].find(elm=>elm.parentNode.getAttribute("data-testid")!=="tweetPhoto");const imgUrl=img.src;const blob=await fetch(imgUrl).then(res=>res.blob());const blobType=blob?.type;if(!/^image\/.+$/.test(blobType)){return}const objectUrl=URL.createObjectURL(blob);const anchor=document.createElement("a");anchor.href=objectUrl;anchor.download=`twitter_${tweetId}_${nth}`;anchor.click();URL.revokeObjectURL(objectUrl)})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:{const t=document.title+" "+location.href,o=t=>{window.prompt("",t)};navigator?.clipboard?.writeText(t).catch(()=>{o(t)})||o(t)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Make docs.rs latest on Google Search | |
// @namespace hexium310 | |
// @version 0.0.1 | |
// @author Hexin | |
// @include /^(http|https):\/\/www\.google\..+\/search.*/ | |
// @downloadUrl https://gist.github.com/hexium310/774465f10e34740849d653c277cf9ab6/raw/make-docs.rs-latest.user.js | |
// @updateUrl https://gist.github.com/hexium310/774465f10e34740849d653c277cf9ab6/raw/make-docs.rs-latest.user.js | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git revert $(git log --oneline | nl >&2; read -p '> ' num; git log --format='%h' --skip=$((num - 1)) -1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autoload -Uz add-zsh-hook | |
__set_head() { | |
if git rev-parse --show-toplevel > /dev/null 2>&1; then | |
alias -g HEAD=$(git symbolic-ref --short \HEAD) | |
fi | |
} | |
__set_head | |
add-zsh-hook chpwd __set_head |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Switching Plain for Markdown on GitHub | |
// @namespace hexium310 | |
// @version 0.3 | |
// @description This userscript adds a button for switching plain/rich for a Markdown blob on GitHub. | |
// @author Hexin | |
// @match https://*.github.com/*/* | |
// @downloadURL https://gist.github.com/hexium310/76eda31e03f7bd09227133a26364bbe8/raw/switch-plain-md-github.user.js | |
// @updateURL https://gist.github.com/hexium310/76eda31e03f7bd09227133a26364bbe8/raw/switch-plain-md-github.user.js | |
// @grant none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat <<< $(jq '{ rules: [{ key: .devDependencies | keys | map(match("(@textlint-.+/)?textlint-rule-.+").string | gsub("^textlint-rule-"; ""))[], value: true }] | from_entries }' package.json | jq -s '.[1] * .[0]' .textlintrc.json -) > .textlintrc.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group-by-range() { | |
setopt LOCAL_OPTIONS EXTENDED_GLOB | |
local value | |
local values=(${(ps: :)1}) | |
local separator=${2--} | |
local tmp_separator=, | |
local result=() | |
local positives=(${(no)${(M)values:#[[:digit:]]##}}) | |
local negatives=(${(nO)${(M)values:#-[[:digit:]]##}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gh api graphql --input <(jq -n --arg owner hexium310 --arg name brew-uo --arg query "$(cat file | tr '\n' ' ')" '{ query: $query, variables: { owner: $owner, name: $name } }') |
NewerOlder