Skip to content

Instantly share code, notes, and snippets.

/**
* Created by FScoward on 15/01/18.
*/
object Luhn {
/**
* Luhn algorithm
* */
def isValid(s: String): Boolean = {
val list = doubleOddValues(toReverseIntList(s))
/* sbt */
name := "packetCapture"
version := "1.0"
scalaVersion := "2.11.4"
libraryDependencies ++= Seq(
"org.pcap4j" % "pcap4j-core" % "1.3.0",
"org.pcap4j" % "pcap4j-packetfactory-static" % "1.3.0",
object Main extends App {
// your code goes here
def fib(n: Int): Int = {
@annotation.tailrec
def loop(count: Int, pp: Int, p: Int): Int = {
// println(s"n: $n, count: $count, pp: $pp, p: $p")
if(count < n - 2) {
loop(count + 1, p, p + pp)
} else {
pp + p
def uncurry[A, B, C](f: A => B => C): (A, B) => C = {
// (A, B) => C なので、まずは (a, b) を受ける
// a, b を受けたら C を返せば良い。
// Cを返すためには 引数として受け取っている f に適用すれば良い
// f: A => B => C なので f(a, b) とすることは出来ないため
// f(a)(b)の部分適用とする
// f(a)(b) は C を返す
(a, b) => f(a)(b)
}
@FScoward
FScoward / script.exs
Created December 11, 2017 05:51
Elixirにおけるwithの挙動
defmodule Etc do
def hello do
IO.puts "Hello"
end
def return_ok do
{:ok, "ok"}
end
require('plugins')
vim.o.number=true
vim.o.expandtab=true
vim.o.smartindent=true
vim.o.softtabstop=2
vim.o.encoding="utf-8"
vim.o.fileencodings="utf-8,cp932"
vim.o.clipboard="unnamed,unnamedplus"
vim.o.shiftwidth=2
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
-- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]]
return require('packer').startup(function()
-- Packer can manage itself
use 'wbthomason/packer.nvim'
use "EdenEast/nightfox.nvim" -- Packer
add_newline = false
[character]
success_symbol = "[😍 ](bold green) "
error_symbol = "[😵 ](bold red) "
[[battery.display]]
threshold = 10
style = "bold red"