Skip to content

Instantly share code, notes, and snippets.

View htsign's full-sized avatar
🤔

htsign htsign

🤔
View GitHub Profile
@htsign
htsign / hatebu-for-inoreader.user.js
Last active July 1, 2024 04:24
はてブの「○○ users」を InoReader に追加する
// ==UserScript==
// @name Hatena bookmark compatibility for InoReader
// @namespace https://htsign.hateblo.jp
// @version 0.4.0
// @description add Hatebu images for InoReader
// @author htsign
// @match https://www.inoreader.com/*
// @match https://jp.inoreader.com/*
// @downloadURL https://gist.github.com/htsign/f32a273d50f0f62b7d220140c5722cad/raw/hatebu-for-inoreader.user.js
// @updateURL https://gist.github.com/htsign/f32a273d50f0f62b7d220140c5722cad/raw/hatebu-for-inoreader.user.js
@htsign
htsign / Sample.cs
Last active November 20, 2020 05:25
prints 1, abc, 5, xyz
using System;
abstract class ItemBase
{
public abstract override string ToString();
}
class IntItem : ItemBase
{
private readonly int value;
public IntItem(int value) => this.value = value;
@htsign
htsign / MyStorage.js
Created December 19, 2019 02:18
simple implementation of Storage interface
export const MyStorage = (() => {
const sym = Symbol();
return class MyStorage {
constructor() {
if (arguments[0] !== sym) {
return new Proxy(new MyStorage(sym), {
get(target, prop) {
if (prop === 'length') return target.length;
const v = Reflect.get(target, prop);
return typeof v === 'function' ? v.bind(target) : target.getItem(prop);
set easymotion
set ideajoin
set surround
set commentary
set incsearch
nnoremap [c :action GotoNextError<CR>
nnoremap ]c :action GotoPreviousError<CR>
curl https://sh.rustup.rs -sSf | sh -s -- --profile default
set -U fish_user_paths ~/.cargo/bin $fish_user_paths
rustup completions fish > ~/.config/fish/completions/rustup.fish
cargo install ripgrep
cargo install bat
cargo install exa
cargo install fd
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
@htsign
htsign / list_creation.pl
Last active July 22, 2020 14:40
SWI-Prolog Exercise
list(N, N, [N]).
list(S, E, L) :-
S < E,
succ(S, X),
list(X, E, L1),
L = [S | L1].
list(S, E, L) :-
S > E,
succ(X, S),
list(X, E, L1),
iterator chunked*[T](xs: openArray[T], size: int, yieldRest = true): seq[T] =
var
i: int
let
last = xs.high
for j in countup(0, xs.len, size + 1):
i = j
if i + size > last: break
yield xs[i .. i + size]
// ==UserScript==
// @name Qiita tagfeed AutoMore
// @namespace https://htsign.hateblo.jp
// @version 0.3.2
// @description auto fetch more entries
// @author htsign
// @include https://qiita.com/timeline*
// @updateURL https://gist.github.com/htsign/0635b47b1af1a4b51719f462b1550f0e/raw/qiitaTimelineAutoMore.user.js
// @downloadURL https://gist.github.com/htsign/0635b47b1af1a4b51719f462b1550f0e/raw/qiitaTimelineAutoMore.user.js
// @grant none
@htsign
htsign / FizzBuzz.nim
Created November 21, 2019 09:17
FizzBuzz
proc fizzBuzz(n: int) =
let (x, y) = (n mod 3, n mod 5)
let s =
if (x, y) == (0, 0): "FizzBuzz"
elif x == 0: "Fizz"
elif y == 0: "Buzz"
else: $n
echo s
for x in 1..100:
import os
import strformat
template until(cond: bool, body: untyped): untyped =
while (true):
if cond: break
body
for param in os.commandLineParams():
if os.existsFile(param):