Skip to content

Instantly share code, notes, and snippets.

View sum.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
if (0 < argc) {
printf("%d\n", main(-argc, argv));
return 0;
}
if (-argc - 1) {
@anekos
anekos / arduino-kitchen-timer
Last active Dec 3, 2018
arduino nano のスリープ機能でキッチンタイマー
View arduino-kitchen-timer
// tone.h Final Countdown melody https://forum.arduino.cc/index.php?topic=202387.0
#include "TM1637.h"
#include <avr/sleep.h>
#define BUZZER_PIN 12
#define WAKEUP_PIN 2
#define SUB_WAKEUP_PIN 3
#define NANA_SEG_CLK 10
View .gitconfig
cancel = !git commit --no-verify -a -m \"Temporary commit for cancel at `date`\" && git reset --hard HEAD~
@anekos
anekos / x-yaml-to-json.vim
Created Nov 2, 2018
自動で YAML に変換して書きだす Vim さん (*.x.yaml とすること)
View x-yaml-to-json.vim
" 自動で YAML に変換して書きだす (*.x.yaml とすること) {{{
function! s:yaml_to_json()
let l:from = expand('%')
let l:to = expand('%:r:r') . '.json'
let l:result = system('ruby -rjson -ryaml -e "puts(JSON.pretty_generate(YAML.load(ARGF.read)))" ' . shellescape(l:from) . ' > ' . shellescape(l:to))
if v:shell_error
echoerr printf("Failed to yaml_to_json: %d\n%s", v:shell_error, l:result)
endif
endfunction
@anekos
anekos / pg-teinen.rb
Created Sep 28, 2018
プログラマ 13619 歳定年
View pg-teinen.rb
'35'.unpack('S')
@anekos
anekos / sketch.ino
Last active Aug 26, 2018
静電タッチキーボード TTP229用のコード
View sketch.ino
/**
* Original code: http://forum.hobbycomponents.com/viewtopic.php?f=73&t=1781
*
*
* This is an example of how to use the Hobby Components 16 key capacitive touch
* keypad (HCMODU0079). This example sketch will read the current state of the
* of the keypad and if a key is pressed output its key number to the serial port.
*
* The sketch assumes that the keypad is configured to 16 key active low mode
* by shorting pads P1-3 and P1-P4 together (see schematic or sport forum for more
@anekos
anekos / myGaps.hs
Created Aug 18, 2018
avoidStruts が上手くいかないので、強引にステータスバーの領域をあける
View myGaps.hs
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, DeriveDataTypeable, TypeSynonymInstances, PatternGuards #-}
module Anekos.Lib.MyGaps (
MyGaps(..),
myGaps
) where
import XMonad
import Graphics.X11 (Rectangle(..))
@anekos
anekos / find-input-device
Created Mar 8, 2018
Tap (メリケンサック)キーボード用スクリプト
View find-input-device
#!/bin/bash
set -euC
# exec 5> /tmp/xmosh/shell-script-debug.out
# BASH_XTRACEFD="5"
# PS4='$LINENO: '
# set -x
if [ "$#" -lt 1 ]
@anekos
anekos / dzen-status
Last active Jan 21, 2018
dzen2 で常時表示のステータスバー的なのを作って、コマンドで更新できるようにする
View dzen-status
#!/bin/bash
# set -x
DZEN_OPTIONS=(-dock -x 1920 -y 0 -w 1920 -ta c -h 20 -fg 'white' -fn 'VL Gothic')
cmd="$1"
@anekos
anekos / app.js
Created Jan 11, 2018
Elgato Stream Deck の自分アプリ
View app.js
// http://www.iconshock.com/flat-icons/general-icons/audio-volume-none-icon
// https://www.svgrepo.com/svg/47144/air-conditioner
// https://www.flaticon.com/packs/characters-and-numbers
// https://github.com/Lange/node-elgato-stream-deck
// https://github.com/joshmarinacci/node-pureimage
const FS = require('fs');
const HTTP = require('http');
const PImage = require('pureimage');
const Path = require('path');