Skip to content

Instantly share code, notes, and snippets.

@negokaz
negokaz / ManyFieldsJsonFormat1.scala
Last active July 9, 2021 02:31
[spray-json] JsonFormat to process more than 22 fields
/*
* case class を分割する方法
*/
import spray.json._
case class Document1(field1: String, field2: String, field3: String, field4: String, field5: String,
field6: String, field7: String, field8: String, field9: String, field10: String,
field11: String, field12: String, field13: String, field14: String, field15: String,
field16: String, field17: String, field18: String, field19: String, field20: String)
@negokaz
negokaz / setsid.pl
Created November 5, 2019 13:44
A Perl implementation of setsid(1)
#!/usr/bin/env perl
#
# A Perl implementation of setsid(1)
#
# setsid(1) - run a program in a new session
# http://man7.org/linux/man-pages/man1/setsid.1.html
use POSIX setsid;
setsid() or die "Failed to create new session";
@negokaz
negokaz / remarkjs-print-pdf.less
Last active June 18, 2019 11:47
Less styles to create PDF from remark.js slides
// see https://github.com/gnab/remark/issues/50#issuecomment-223887379
@page {
// for 4:3
size: 908px 681px !important;
// for 16:9
// size: 1210px 681px !important;
margin: 0 !important;
}
@media print {
@negokaz
negokaz / exec_ps1.cmd
Last active September 13, 2023 09:50
Execute PowerShell script which has same name
@echo off
powershell -NoProfile -ExecutionPolicy RemoteSigned ^
"Start-Process powershell.exe -ArgumentList %~dp0\%~n0.ps1 -WindowStyle Hidden"
# /etc/systemd/system/jstatd.service
#
# Install:
# - Put this file on /etc/systemd/system/jstatd.service
# - Rewrite <host ip>
#
# Usage:
# sudo systemctl enable jstatd
# sudo systemctl start jstatd
#
@negokaz
negokaz / prepare-commit-msg
Last active August 23, 2018 03:51
git prepare-commit-msg hook for emojified commit message prefix
#!/bin/bash
# git prepare-commit-msg hook for emojified commit message prefix
# inspired by:
# - Angular Commit Message Conventions
# https://github.com/angular/angular.js/blob/v1.7.2/DEVELOPERS.md#type
# - Git Commit message Emoji · GitHub
# https://gist.github.com/parmentf/035de27d6ed1dce0b36a
#
# Install
# - Run following command in your git working directory
@negokaz
negokaz / csudo.sh
Last active April 25, 2018 07:00
sudo command for ConEmu
#!/bin/bash
# This is "sudo" command for ConEmu.
# Inspired by csudo.cmd in ConEmu.
# Usage:
# sudo choco upgrade all
# Installation:
# Place in ConEmu's directory.
# ex) C:\Program Files\ConEmu\ConEmu
@negokaz
negokaz / markdownarea.md.html
Last active October 10, 2018 00:44
Template markdownarea.js
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<style>
body, html, div { width:100%; height: 100%; }
textarea.markdownarea { width: 100%; height: 100%; border: none; }
</style>
</head>
@negokaz
negokaz / aws-ssh.sh
Last active January 30, 2020 01:56
AWS Dev Helper Scripts
#!/bin/bash
#
# 稼働中(running)のEC2インスタンスの一覧から SSH できるようにする
function main {
local filter="$1"
local all_instances="$(fetch_runnning_instances)"
local candidate_instances="$(echo "${all_instances}" | grep --color=always "${filter}")"
/**
* remark preview css
*/
.remark-container {
overflow: visible;
}
.remark-slide-container {
--slide-ratio: 3/4;