Skip to content

Instantly share code, notes, and snippets.

View mitsuji's full-sized avatar

Mitsuji, Takamasa mitsuji

View GitHub Profile
-module(flashpolicy).
-vsn("0.9.01").
-export([ start/0, stop/0 ]).
-export([ init/3 ]).
-export([ wait/2 ]).
-define(POLICY_FILE, "/path/to/policyfile.xml").
start() ->
start(?POLICY_FILE, 843, 3 ).
package org.mitsuji
import java.net._
import java.io._
import java.util.Date
import java.util.concurrent._
object FlashPolicyServer {
val server = new FlashPolicyServer()
#include <iostream>
#include <iomanip>
// int version
void memdumpi(void* vptr, size_t len)
{
std::cout << ">>>> memdump(int) ---------------------------" << std::endl;
unsigned int* cptr = reinterpret_cast<unsigned int*>( vptr );
for (size_t i=0; i<(len/sizeof(int)); ++i )
#pragma comment(lib, "crypt32.lib")
#include <cstddef>
#include <string>
#include <windows.h>
#include <Wincrypt.h>
bool encrypt(const std::string& key, const std::string& plain, void* crypt, size_t* crypt_len )
{
DATA_BLOB key_bolb;
module HDaemon.Server where
import Control.Concurrent
import System.IO
data SStatus = Run | Shutdown | Stop deriving( Eq )
type SHandle = MVar SStatus
start :: String -> IO(SHandle)
start confPath = do
module HDaemon.Foreign where
import System.Environment
import Foreign
import HDaemon.Server
foreignStart :: IO(StablePtr(SHandle))
foreignStart = do
logPath <- getLogPath
module HDaemon.Daemon where
import Control.Concurrent
import System.Environment
import System.Posix.Signals
import Foreign
import HDaemon.Server
termHandler :: MVar Bool -> SHandle -> IO()
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <HsFFI.h>
#include "HDaemon/Daemon_stub.h"
extern void __stginit_HDaemonziDaemon(void);
int save_pid()
@mitsuji
mitsuji / gist:1194535
Created September 5, 2011 09:19
Posix Time in VBScript
Function GetPosixTimeStr()
Dim nMinutesInDay
nMinutesInDay = 60 * 60 * 24
Dim nMinutesNow
nMinutesNow = CDbl(Now) * nMinutesInDay
nMinutesNow = nMinutesNow -( 9 * 60 * 60 ) '' UTC
Dim nMinutesEpoch
@mitsuji
mitsuji / gist:1629893
Created January 18, 2012 00:00
identon2 check
// file: identon2.cpp
//
// gcc -xc++ -lstdc++ identon2.cpp
// CL /TP /EHsc identon2.cpp
#include <limits.h>
#include <sstream>
#include <iostream>