Skip to content

Instantly share code, notes, and snippets.

View htsign's full-sized avatar
🤔

htsign htsign

🤔
View GitHub Profile
// ==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):
{
"editor.DetectIndentation": true,
"editor.fontFamily": "Cica",
"editor.fontSize": 16,
"editor.LargeFileOptimizations": true,
"editor.highlightActiveIndentGuide": true,
"editor.indentSize": 4,
"editor.insertSpaces": true,
"editor.lineNumbers": "on",
"editor.matchBrackets": true,
@htsign
htsign / excelRegFixer.fsx
Last active July 30, 2019 09:39
fix "OpenAsReadOnly" in registry for excel
let notNull (x : 'a when 'a : null) = not (isNull x)
module Regex =
open System.Text
let m x = Regex(x)
let isMatchWithString pattern input = Regex.IsMatch(input, pattern)
let isMatchWithRegex (r : Regex) input = r.IsMatch(input)
let matchWithString pattern input =
match Regex.Match(input, pattern) with
@htsign
htsign / config.tsx
Last active December 12, 2019 00:34
Onivim setup on windows
import * as React from "react"
import * as Oni from "oni-api"
export const activate = (oni: Oni.Plugin.Api) => {
console.log("config activated")
// Input
//
// Add input bindings here:
//
@htsign
htsign / IO.fs
Last active July 8, 2019 02:42
実験的に Seq<'T> と Async<'T> を混ぜてみた
module IO =
open System.IO
open System.Threading.Tasks
// 普通の unfold
let readLines (reader : TextReader) =
match reader with
| null -> nullArg "reader"
| r -> r |> Seq.unfold (fun r -> match r.ReadLine() with null -> None | s -> Some (s, r))
@htsign
htsign / ubuntu-18.04.sh
Last active June 28, 2019 05:26
japanize
sudo sed -i.bak -e "s/http:\/\/archive\.ubuntu\.com/http:\/\/jp\.archive\.ubuntu\.com/g" /etc/apt/sources.list && \
sudo apt update && \
sudo apt install -y \
language-pack-ja \
manpages-ja \
manpages-ja-dev \
tzdata \
&& \
sudo update-locale LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja" && \
sudo ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime && \
@htsign
htsign / fsharp.msy
Created June 26, 2019 01:44
syntax definition file of mery https://www.haijin-boys.com/wiki/
#TagBegin=
#TagEnd=
#CommentBegin1=(*
#CommentEnd1=*)
#LineComment1=//
#CommentBegin2="""
#CommentEnd2="""
#LineComment2=
#SpecialSyntax=None
#ScriptBegin=
string ConvertAlphabet(int index)
{
var chars = new List<char>();
int d = index;
while (d != 0)
{
d = Math.DivRem(d, 26, out int r);
r = r == 0 ? 26 : r;
chars.Insert(0, (char)('A' + r - 1));