Skip to content

Instantly share code, notes, and snippets.

@iseebi
iseebi / fu.hs
Created March 11, 2015 12:01
すごいHaskell読書会 in 大阪 2周目 #16
type Pos = (Int, Int)
checkCol :: Pos -> [Pos] -> Bool
checkCol (row, col) l = not . elem True $ map (\(_, col') -> col' == col) l
putFu :: Pos -> [Pos] -> Maybe [Pos]
putFu (row, col) l
| row < 1 = Nothing
| row > 8 = Nothing
| col < 1 = Nothing
| col > 9 = Nothing
#!/bin/bash
LANG=ja_JP.utf8
pid=$$
date=`date '+%Y-%m-%d-%H_%M'`
playerurl=http://radiko.jp/player/swf/player_3.0.0.01.swf
playerfile="/tmp/player.swf"
keyfile="/tmp/authkey.png"
data Warrior = Warrior Int
data Monster = Monster Int Int
data Attack = Normal | Critical | Gira | Begirama
hitPoint :: Monster -> Int
hitPoint (Monster hp _) = hp
damage :: Warrior -> Monster -> Attack -> Int
damage (Warrior attack) (Monster _ defence) Normal = truncate $ max 1.0 ((realToFrac attack - (realToFrac defence / 2)) / 2)
damage (Warrior attack) _ Critical = attack
@iseebi
iseebi / twitter_add_user_to_list_bulk.rb
Last active August 29, 2015 13:59
Twitterリスト一括登録
# -*- coding: utf-8 -*-
require "twitter"
client = Twitter::REST::Client.new do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.access_token = "YOUR_ACCESS_TOKEN"
config.access_token_secret = "YOUR_ACCESS_SECRET"
end
@iseebi
iseebi / Program.cs
Last active August 29, 2015 13:57
Twitter 片思い抽出
using System;
using AsyncOAuth;
using System.Security.Cryptography;
using Newtonsoft.Json.Linq;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace KataomoiList
{
@iseebi
iseebi / goodnumber.hs
Created January 9, 2014 12:12
すごいHaskell読書会 #15 - 練習問題復習 @ #1
scanDigits :: Int -> Int -> (String, String)
scanDigits a x = (take a $ show x, drop a $ show x)
calcTuple :: (String, String) -> Int
calcTuple (x, y) = (read x) + (read y)
calc :: Int -> (Int, Int)
calc x = (calcTuple (scanDigits 1 x), calcTuple (scanDigits 2 x))
checkCalc :: Int -> (Int, Int) -> Bool
@iseebi
iseebi / Konashi.cs
Created September 1, 2013 08:25
Use Konashi from FEZ Cerberos (Konashi: BLE-enabled pyshical computing toolkit http://konashi.ux-xu.com/) (FEZ Cerberos: .NET Gadgeteer Mainboard)
using System;
using Microsoft.SPOT;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using GTI = Gadgeteer.Interfaces;
using System.IO;
using System.Text;
namespace GadgeteerApp2
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:text="Please enter name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace Test01a
@iseebi
iseebi / uuids.plist
Created May 1, 2013 06:47
BLExplr に読み込ませてる uuids.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Services</key>
<array>
<dict>
<key>0x1804</key>
<string>Tx Power</string>
</dict>