Skip to content

Instantly share code, notes, and snippets.

@non117
non117 / inotify_daemon.py
Created December 18, 2013 03:12
python inotify daemon
import multiprocessing
import os
import time
from functools import partial
import pyinotify
def is_alive(pid):
try:
os.kill(pid, 0)
@non117
non117 / mendako.js
Last active December 4, 2020 05:54
めんだこが降ります
w = () => window.innerWidth * 0.95
h = () => window.innerHeight * 0.95
r = Math.random
men = () => {
base = "https://media.handon.club/custom_emojis/images/000/"
if(r() > 0.01) {
return `${base}008/726/original/mendako_anime.png`
} else {
p = r()
if(p > 0.67) {
@non117
non117 / c4-xlarge_cpuminer-multi.log
Created December 13, 2017 14:47
cpuminer bench on EC2
[2017-12-13 14:46:05] Starting Stratum on stratum+tcp://jp.lapool.me:3014
[2017-12-13 14:46:05] 4 miner threads started, using 'yescrypt' algorithm.
[2017-12-13 14:46:08] Stratum difficulty set to 0.5 (0.00001)
[2017-12-13 14:46:10] CPU #2: 0.42 kH/s
[2017-12-13 14:46:10] accepted: 1/1 (diff 0.000), 0.42 kH/s yes!
[2017-12-13 14:46:10] CPU #1: 0.42 kH/s
[2017-12-13 14:46:10] CPU #0: 0.42 kH/s
[2017-12-13 14:46:10] CPU #3: 0.42 kH/s
[2017-12-13 14:46:20] CPU #3: 0.42 kH/s
[2017-12-13 14:46:20] accepted: 2/2 (diff 0.000), 1.67 kH/s yes!
@non117
non117 / Task.js
Last active March 30, 2017 11:06
redux design models
import { PropTypes } from 'react';
import { Record } from 'immutable';
import { recordOf } from 'react-immutable-proptypes';
const TaskRecord = new Record({
id: undefined,
name: '',
deadline: undefined,
checked: false,
});
@non117
non117 / TaskItem.jsx
Last active March 26, 2017 01:08
redux design components
import React, { PropTypes } from 'react';
import { Task } from '../../models';
export default class TaskItem extends React.PureComponent {
static propTypes = {
task: Task.PropTypes.isRequired,
}
static contextTypes = {
changeInputTarget: PropTypes.func,
checkTask: PropTypes.func,
@non117
non117 / Todo.js
Created March 25, 2017 08:13
redux design ducks
import { createAction, handleActions } from 'redux-actions';
import { takeEvery } from 'redux-saga';
import { call, put } from 'redux-saga/effects';
import { TodoState } from '../models';
const CREATE_TASK = 'CREATE_TASK';
const UPDATE_TASK = 'UPDATE_TASK';
const CHECK_TASK = 'CHECK_TASK';
const SUBMIT_TASK = 'SUBMIT_TASK';
const CHANGE_INPUT = 'CHANGE_INPUT';
@non117
non117 / frontModel.md
Last active December 14, 2016 13:57
fluxでのmodelのデータ構造について

背景

  • リストでチェックボックスのついてるやつをReact + Fluxでつくる
  • このときのjsレイヤのデータ構造をどうするか

問題

  • 単純にリストにするとアクションを適用するオブジェクトを選ぶのにfilterしないといけないのでは?

こんなAction

{
@non117
non117 / OCRClient.swift
Created October 26, 2016 13:41
OCRくん
//
// OCRClient.swift
// ReceiptManager
//
// Created by non on 2016/10/10.
// Copyright © 2016年 non. All rights reserved.
//
import Foundation
import Alamofire
@non117
non117 / snipet.md
Last active February 21, 2016 14:28
golangお勉強

ifのよくあるパターン

break, continue, goto, returnで抜ける

f, err := os.Open(name)
if err != nil {
    return err
}
d, err := f.Stat()
if err != nil {
 return err
@non117
non117 / suicide.py
Created December 18, 2013 02:23
親が死んだら自殺する子.py
import multiprocessing
import os
import time
def is_alive(pid):
try:
os.kill(pid, 0)
except OSError:
return False
else: