Skip to content

Instantly share code, notes, and snippets.

View seraphy's full-sized avatar

seraphy seraphy

View GitHub Profile
@kawasima
kawasima / SafeRequestProcessor.java
Last active August 29, 2015 14:00
A workaround for CVE-2014-0114
package example;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.Globals;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServletWrapper;
import org.apache.struts.action.RequestProcessor;
import org.apache.struts.config.ModuleConfig;
import org.apache.struts.taglib.html.Constants;
@aoetk
aoetk / ShapeSample.css
Last active August 29, 2015 14:02
JavaFXでSVGアイコンを使ったボタンのサンプル
.button-icon-shape {
-fx-scale-x: 2.0;
-fx-scale-y: 2.0;
}
.stop-button-icon {
-fx-fill: black;
}
.circle-button {
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>fxxk_it_alert</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/osascript</string>
<string>/Users/ozaki/bin/fxxk_it_alert.scpt</string>
@takawitter
takawitter / gist:5895868
Last active December 19, 2015 04:18
ThreadPoolExecutorに値を返すlambda(or closure)をsubmitしたい。submit(Callable<T> task)が呼ばれればOKなんだけど、ThreadPoolExecutorにはsubmit(Runnable task)も存在するので、普通にlambdaを渡すと曖昧性が解消できない。そのためCallable<T>を明示する必要があるが、その方法が言語によって違うって話。 ScalaとJythonとJRubyは直接やる方法が無さそうなので、ラッパークラスをかましてる。
/*
* tp は Executors.newCachedThreadPool 等を使って生成
*/
// Rhino(JavaScript)
tp.submit(new Callable({call: function(){ return 1;}}));
// Groovy
tp.submit({1} as Callable)
@kumagi
kumagi / benchmark.cc
Created June 17, 2012 03:23
single thread Hopscotch hashing with C++
#ifndef MAP_HPP
#define MAP_HPP
//#include <cstdint>
#include <stdint.h>
#include <cstddef>
#include <map>
#include <functional>
#include <boost/functional/hash.hpp>
#include <memory>
#include <utility>
@jewelsea
jewelsea / PopupButton.java
Last active October 31, 2016 16:05
Shows how to make a small context sensitive dialog which popups on pressing a button.
import java.util.Random;
import javafx.application.Application;
import javafx.event.*;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextAlignment;
import javafx.stage.Stage;
//
// ToyGC.swift
// ToyGC
//
// Created by satoshia on 2015/08/31.
// Copyright © 2015 satoshia. All rights reserved.
//
import Darwin
import Foundation
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
//Interfaces for working with excel
//this file allows me to not have a reference to excel in the project
//Adding a reference is to a specific version, these interfaces apply to all
//see Kenny Ker's blog http://weblogs.asp.net/kennykerr/archive/2008/12/16/Rtd7.aspx
@hayajo
hayajo / README.md
Created April 4, 2016 08:21
Server::StarterでJavaのWebアプリを起動する

Server::StarterでJavaのWebアプリを起動する

Scalatraで作成されJettyを組み込んだ実行可能なjarをServer::Starterで実行して、ホットデプロイを可能にするまでの簡単な手順です。

これにより、クラスローダーを利用した運用からLLと同様な形態でアプリケーションを運用することが可能となります(アプリケーションごとにJVMプロセスを起動する)。

@koyhoge
koyhoge / report.md
Last active November 18, 2018 02:35
エンジニアのための法律勉強会 #8『盗用と著作権の基礎知識と注意点&エンジニアのための?!結婚と離婚の基本のキ(番外編)』  参加メモ

エンジニアのための法律勉強会 #8『盗用と著作権の基礎知識と注意点&エンジニアのための?!結婚と離婚の基本のキ(番外編)』 参加メモ

イベントURL: https://coedo-dev.doorkeeper.jp/events/31461