Skip to content

Instantly share code, notes, and snippets.

const extractTweetTimeFromId = id => Math.floor(parseInt(id, 10) / 4194304) + 1288834974657
@ciffelia
ciffelia / reboot.service
Created June 1, 2021 16:58
毎週月曜日午前3時に再起動
# /etc/systemd/system/reboot.service
[Unit]
Description = Reboot
RefuseManualStart = true
RefuseManualStop = true
[Service]
ExecStart = /sbin/reboot

Tools

pacman -S vim zsh zsh-completions exa bat file bind
  • vim
  • zsh, zsh-completions
  • exa: ls を見やすくしたやつ
  • bat: cat with syntax highlighting
@ciffelia
ciffelia / config.txt
Created August 24, 2020 15:44
Raspberry Pi LEDs - /boot/config.txt
# Turn off PWR LED (Red)
dtparam=pwr_led_trigger=none,pwr_led_activelow=on
# Turn on ACT LED (Green)
dtparam=act_led_trigger=default-on
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import random
import string
from PIL import Image, ImageOps
#include <iostream>
#include <bitset>
#include <unordered_set>
#include <climits>
constexpr auto uint64_bits = CHAR_BIT * sizeof(uint64_t);
using show_bits = std::bitset<uint64_bits>;
uint64_t to_bitmask(const std::unordered_set<uint8_t>& from)
{
@ciffelia
ciffelia / stripMargin.js
Last active May 31, 2018 06:39
stripMargin.js
const stripMargin = (string, marginPrefix = '|') => {
const lines = string.replace(/^\n|\n+$/g, '').split('\n');
let result = '';
lines.forEach((val, i) => {
const indexOfMarginPrefix = val.indexOf(marginPrefix);
if(indexOfMarginPrefix !== -1) {
result += val.slice(indexOfMarginPrefix + 1) + '\n';
}
@ciffelia
ciffelia / nodejs-doc-redirect.js
Last active December 26, 2016 03:09
検索で一番上に引っかかるNode.js v7.x DocumentationからNode.js v6.x Documentationに自動でリダイレクトするUserScript https://gist.github.com/prince-0203/dd649892400c8fb7da9b/raw/nodejs-doc-redirect.js
// ==UserScript==
// @name Node.js API Doc Redirect
// @version 1.0.1
// @match https://nodejs.org/api/*
// @run-at document-start
// ==/UserScript==
(() => {
'use strict';
location.pathname = '/dist/latest-v6.x/docs' + location.pathname;
@ciffelia
ciffelia / HSPTV! Forum Script.js
Last active March 12, 2017 11:42
HSPTV!掲示板用のUserScriptです。
// ==UserScript==
// @name HSPTV! Forum Script
// @version 1.1.2
// @description HSPTV!掲示板用のUserScriptです。
// @author prince
// @homepage http://prince0203.github.io/
// @copyright (c)prince 2016
// @namespace io.github.prince0203
// @icon http://hsp.tv/favicon.ico
// @match http://hsp.tv/play/pforum.php?mode=*
@ciffelia
ciffelia / Japan Minecraft Network API.md
Last active October 3, 2016 05:40 — forked from ikr7/apis
Japan Minecraft Network API

R.I.P.