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
package com.walbrix.servlet; | |
import java.io.IOException; | |
import javax.servlet.Filter; | |
import javax.servlet.FilterChain; | |
import javax.servlet.FilterConfig; | |
import javax.servlet.ServletException; | |
import javax.servlet.ServletRequest; | |
import javax.servlet.ServletResponse; | |
import javax.servlet.http.Cookie; |
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
#!/usr/bin/ruby | |
require "fileutils" | |
COMPRESSION_SUFFIXES = {"gzip"=>".gz","bzip2"=>".bz2","lzma"=>".lzma","xz"=>".xz",nil=>""} | |
def receive_and_store(basename, suffix, destination, compression_program) | |
tmpfile = "#{destination}/00-#{basename}-in-progress" | |
if compression_program != nil | |
compression_suffix = COMPRESSION_SUFFIXES[compression_program] |
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
--- invoice.js.old 2014-04-25 07:51:39.000000000 +0900 | |
+++ invoice.js 2014-04-25 07:51:21.000000000 +0900 | |
@@ -8,6 +8,7 @@ | |
$scope.year = parseInt(data["番号"].substr(0,4)); | |
$scope.month = parseInt(data["番号"].substr(4,2)); | |
$scope.day = parseInt(data["番号"].substr(6,2)); | |
- $scope.taxPercent = 5; | |
+ $scope.taxPercent = 8; | |
+ if ($scope.year * 100 + $scope.month < 201404) $scope.taxPercent = 5; | |
$scope.tax = Math.floor($scope.minorTotal * $scope.taxPercent / 100); |
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
module.exports = function(grunt) { | |
grunt.initConfig({ | |
ngtemplates: { | |
app: { | |
src: "*.html", | |
dest: "template.js" | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-angular-templates'); |
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
package com.walbrix.jackson | |
import com.fasterxml.jackson.databind.JsonSerializer | |
import com.fasterxml.jackson.core.JsonGenerator | |
import com.fasterxml.jackson.databind.SerializerProvider | |
import com.fasterxml.jackson.databind.module.SimpleModule | |
import com.fasterxml.jackson.core.Version | |
import java.util.Calendar | |
import java.sql.Date | |
import java.sql.Time |
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
val src = Seq( | |
(1, "shimariso", 1), | |
(1, "shimariso", 2), | |
(1, "shimariso", 3), | |
(2, "sorimashi", 4), | |
(2, "sorimashi", 5), | |
(2, "sorimashi", 6) | |
) // SQLで一対多関係にあるふたつのテーブルをJOINしていっぺんに持ってきたと思いねえ(IDでorder by済み) | |
case class Result(id:Int, name:String, nums:Seq[Int]) |
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 com.nimbusds.jose.Payload | |
import com.nimbusds.jose.JWSHeader | |
import com.nimbusds.jose.JWSAlgorithm | |
import com.nimbusds.jose.JWSObject | |
import com.nimbusds.jose.crypto.MACSigner | |
import com.nimbusds.jose.crypto.MACVerifier | |
object NimbusJoseJwt { | |
def main(args: Array[String]): Unit = { | |
// Create JWS payload |
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 scala.collection.JavaConversions._ | |
import com.nimbusds.jose.{JWEHeader,EncryptionMethod,JWEAlgorithm,JOSEException} | |
import com.nimbusds.jose.crypto.{DirectEncrypter,DirectDecrypter} | |
import com.nimbusds.jwt.{JWTClaimsSet,EncryptedJWT,ReadOnlyJWTClaimsSet} | |
import java.text.ParseException | |
object JWT { | |
val sharedKey = "GLU9nOFeRfBUy89d".getBytes /* 適当な暗号キー(共通鍵なので要秘匿) */ |
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
#!/usr/bin/python | |
import os,sys,re | |
users = {} | |
def process_line(line): | |
if line.startswith('#'): return | |
line_splitted = re.split(r'\s', line) | |
if len(line_splitted) < 3: return | |
users[line_splitted[0]] = line_splitted[2] |
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
package main | |
// #include <stdio.h> | |
import "C" | |
func main() { | |
C.puts(C.CString("Hello, World!")) | |
} |
OlderNewer