Skip to content

Instantly share code, notes, and snippets.

div.js-calendar-graph {
margin-top: 1rem;
display: flex !important;
flex-direction: column !important;
align-items: flex-end !important;
overflow: hidden !important;
margin-right: 8px !important;
margin-left: 8px !important;
}
@moxak
moxak / render-codeblock.html
Created June 5, 2022 11:22
Hugo: layouts/_default/_markup/に設置するテンプレートファイル。コードブロックの名前を表示するdivタグを追加する。
<div>
{{- $name := .Attributes.name -}}
{{ with $name }}<div class="codeblock--name">{{ . }}</div>{{ end }}
<div class="codeblock--content">
{{- highlight (.Inner | safeHTML) .Type .Options }}
</div>
</div>
<style>
.codeblock--name {
width: fit-content;
/* margin: 1rem 0 0; */
font-size: 0.9rem;
color: white;
/* background-color: #272822; */
background-color: #4f4f4f;
padding: 0.3rem 0.8rem !important;
/* font-weight: 400; */
@moxak
moxak / publish.sh
Last active June 3, 2022 04:03
GitHub Pagesへのデプロイを自動化するシェルスクリプト。
#!/bin/bash
USERNAME='moxak'
function publish() {
USERNAME=$1
ESC=$(printf '\033')
echo "---Build by hugo."
hugo --minify >/dev/null
echo "---Move and copy files."
mv content/*/*.png static/img/ &>/dev/null
cp CNAME docs/
@moxak
moxak / body.html
Created June 2, 2022 05:45
Hugo Book Themeに「数式表示」「コードブロックコピー時のトースト通知表示」「カラーテーマ変更ボタン」「目次表示切り替えボタン」を追加するパーシャルレイアウト。
{{ define "katex-stylesheet" }}
{{ if .Params.katex }}
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/katex.min.css"
integrity="sha384-ZPe7yZ91iWxYumsBEOn7ieg8q/o+qh/hQpSaPow8T6BwALcXSCS6C6fSRPIAnTQs"
crossorigin="anonymous"
/>
<link
href="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/contrib/copy-tex.css"
@moxak
moxak / token.py
Last active March 15, 2024 11:05
This is one to modify twint which is python module to scrape twitter without API token. In order to use, you must put this script on `twint/` and replace defalt one.
import re
import time
import requests
import logging as logme
class TokenExpiryException(Exception):
def __init__(self, msg):
super().__init__(msg)
window.addEventListener("DOMContentLoaded", init);
function init() {
const width = 960;
const height = 540;
const renderer = new THREE.WebGLRenderer({
canvas: document.querySelector('#myCanvas')
});
renderer.setPixelRatio(window.devicePixelRatio);