Skip to content

Instantly share code, notes, and snippets.

7shi 7shi

Block or report user

Report or block 7shi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@7shi
7shi / XmlParser.fsx
Last active Aug 29, 2015
[F#]簡易 XML Parser
View XmlParser.fsx
open System
open System.IO
open System.Text
let fromEntity(s: string) =
s.Replace("&lt;", "<").
Replace("&gt;", ">").
Replace("&quot;", "\"").
Replace("&nbsp;", " ").
Replace("&amp;", "&")
@7shi
7shi / Serialize.fsx
Created Jul 10, 2014
[F#]シリアライズのテスト
View Serialize.fsx
#nowarn "9"
open System
open System.IO
open System.Runtime.InteropServices
[<StructLayout(LayoutKind.Sequential)>]
type Test = struct
val mutable Foo:int
val mutable Bar:uint16
@7shi
7shi / do.fsx
Created Jul 10, 2014
[F#]doのインデント
View do.fsx
#r "System"
#r "System.Windows.Forms"
open System
open System.Windows.Forms
[<EntryPoint; STAThread>] do
let w = new Form(AllowDrop = true)
Application.Run w
@7shi
7shi / ConvGray8.fsx
Last active Aug 29, 2015
[F#]グレースケールJPEGに変換
View ConvGray8.fsx
// This file is in the public domain.
#r "System"
#r "System.Xaml"
#r "PresentationCore"
#r "PresentationFramework"
#r "WindowsBase"
open System
open System.IO
@7shi
7shi / Run_Python.js
Last active Aug 29, 2015
[JavaScript]KomodoのPython実行用マクロ
View Run_Python.js
komodo.assertMacroVersion(3);
if (komodo.view) komodo.view.setFocus();
ko.commands.doCommand('cmd_save');
ko.run.runEncodedCommand(window, '%(python) \"%F\" {\'cwd\': u\'%D\'}');
@7shi
7shi / loop.bf
Created Jul 22, 2014
[Brainf*ck]約1億回ループ
View loop.bf
++++++[>-[>-[>-[-]<-]<-]<-]
@7shi
7shi / test.js
Last active Aug 29, 2015
[JavaScript]Brainf*ckを手動トランスレート
View test.js
// ++++++[>++++++<-]+[>.>,.<<]
var mem = new Uint8Array(30000);
var reg = 0;
var pc = [];
var buf = "";
function putchar() {
process.stdout.write(String.fromCharCode(mem[reg]));
}
@7shi
7shi / binary.hs
Last active Aug 29, 2015
[Haskell]バイナリ操作の取っ掛かり
View binary.hs
{-# LANGUAGE CPP, TemplateHaskell #-}
-----------------------------------------------------------------------------
--
-- Module : Main
-- Copyright :
-- License : Public Domain
--
-- Maintainer :
-- Stability :
-- Portability :
View jit-mac.js
var ref = require("ref");
var ffi = require("ffi");
var libc = ffi.Library("libc", {
"mmap": ["pointer", ["pointer", "size_t", "int", "int", "int", "int64"]],
"munmap": ["int", ["pointer", "size_t"]],
});
var PROT_READ = 1;
var PROT_WRITE = 2;
@7shi
7shi / 1mkbin.fsx
Last active Aug 29, 2015
ARM64の調査。移転しました → https://bitbucket.org/7shi/arm64
View 1mkbin.fsx
open System.IO
for i in 0..0xff do
let dir1 = sprintf "%02x" i
if not <| Directory.Exists dir1 then
ignore <| Directory.CreateDirectory dir1
for j in 0..0xff do
let path = Path.Combine(dir1, sprintf "%02x.bin" j)
printfn "%s" path
let b = (i <<< 24) ||| (j <<< 16)
You can’t perform that action at this time.