This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ g++ main.cpp -std=c++11 -I/usr/local/Cellar/boost/1.66.0/include -lboost_date_time | |
$ ./a.out | |
2018-02-24T00:09:55.980492+09:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import qualified Data.ByteString.Char8 as BC8 | |
import System.IO | |
main :: IO () | |
main = mapM_ (BC8.hPut stdout) (repeat "y\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Functor f where | |
-- | fmap は上記説明通りの定義になってますね | |
fmap :: (a -> b) -> f a -> f b | |
class Functor f => Applicative f where | |
pure :: a -> f a | |
-- | <*> は上記説明通りの定義になってますね | |
(<*>) :: f (a -> b) -> f a -> f b | |
liftA2 :: (a -> b -> c) -> f a -> f b -> f c | |
(*>) :: f a -> f b -> f b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── app | |
│ └── Main.hs | |
└── src | |
├── Hello | |
│ └── Plugin.hs | |
└── Hello.hs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let foo = "foo"; | |
if (foo) console.log("bar"); // => "bar" | |
foo = null; | |
if (foo) console.log("bar"); // => 出力なし | |
foo = "foo"; | |
console.log(foo && foo.length === 3); // => true | |
foo = null; | |
console.log(foo && foo.length === 3); // => null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Concurrent | |
import Control.Monad | |
import System.RaspberryPi.GPIO | |
led = Pin08 | |
button = Pin07 | |
main = withGPIO $ do | |
setPinFunction led Output | |
setPinFunction button Input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew install ddrescue | |
$ curl -LO https://downloads.raspberrypi.org/raspbian_lite_latest | |
$ unzip raspbian_lite_latest | |
$ for f in `ls *-raspbian-*.img`; do IMG=$f; done | |
$ diskutil list # SD カードがどのデバイスかを目視確認する(ここでは /dev/disk2 として進める) | |
$ DISK=disk2 # ここで目視したディスクを環境変数に入れる | |
$ diskutil unmountDisk /dev/$DISK | |
$ sudo ddrescue $IMG /dev/$DISK --force | |
$ touch /Volumes/boot/ssh # ssh を有効にする | |
$ diskutil eject $DISK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://username:password@example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.List; | |
public class Main { | |
public static void main(String... args) { | |
String[] array = new String[10000]; | |
List<String> list = new ArrayList<>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prelude> :m + Data.ByteString.Char8 | |
Prelude Data.ByteString.Char8> :m + Codec.Binary.UTF8.String | |
Prelude Data.ByteString.Char8 Codec.Binary.UTF8.String> pack "ほげ" -- ダメなパターン | |
"{R" | |
Prelude Data.ByteString.Char8 Codec.Binary.UTF8.String> pack $ encodeString "ほげ" -- 良いパターン | |
"\227\129\187\227\129\146" | |
Prelude Data.ByteString.Char8 Codec.Binary.UTF8.String> unpack $ pack $ encodeString "ほげ" -- ダメなパターン | |
"\227\129\187\227\129\146" | |
Prelude Data.ByteString.Char8 Codec.Binary.UTF8.String> decodeString $ unpack $ pack $ encodeString "ほげ" -- 良いパターン | |
"\12411\12370" |
NewerOlder