Skip to content

Instantly share code, notes, and snippets.

View long-long-float's full-sized avatar
💭
☕ コーヒーが燃料デス

long_long_float long-long-float

💭
☕ コーヒーが燃料デス
View GitHub Profile
@long-long-float
long-long-float / content.md
Created December 12, 2017 03:15
seccomp2017 AdC

これはseccamp2017 Advent Calendar 12日目の記事です。

進捗どうですか?

進捗、あるにはあるのですが(コンパイラ関係のバイトを始めることができた)記事にできるほどのものではないので自分がセキュリティキャンプに応募した時の文章を晒します。自分は集中コースX「言語やOSを自作しよう」の言語自作ゼミを受講しました。

来年応募しようと思っている人は受講対象に対する想いをぶつければ行けると思います(適当)。進捗があればチューター業をやりたいと思っているのでその時はよろしくお願いします。

共通問題

["for", ["range", 0, 100], ["do", ["n"],
["print", ["switch",
["=", ["%", ["n"], 15], 0], "FizzBuzz",
["=", ["%", ["n"], 3], 0], "Fizz",
["=", ["%", ["n"], 5], 0], "Buzz",
["n"]
]]
]]
@long-long-float
long-long-float / generator.rb
Created April 27, 2016 17:26
titech情報科学科の機械語シュミレータのトランスレータ
# Usage: ruby generator.rb FILE
class MLS < BasicObject
attr_reader :ops
def initialize
@ops = []
@addr = 0
@labels = {}
@label_count = 0
@long-long-float
long-long-float / README.md
Last active September 6, 2016 04:50
るりま(Ruby リファレンスマニュアル)を最新に更新するブックマークレット

るびま(Ruby リファレンスマニュアル)を最新に更新するブックマークレットです

  1. bookmarklet.jsをブックマークレットとして登録してください
  2. るびまのページに行きます
  3. うわっ、古いって思ったらブックマークレットをクリックすると最新の(ではなくブックマークレット内のVERSION)るびまになります
@long-long-float
long-long-float / gen-toc.rb
Created December 22, 2015 13:42
Markdownの目次を作るスクリプト
#!/usr/bin/env ruby
TITLE_REGEXP = /(#+) (.+)/
text = File.read(ARGV[0]).split("\n")
numbers = []
counts = Array.new(6){ 0 }
prev_level = 0
text.each do |line|
@long-long-float
long-long-float / convert.rb
Created February 1, 2015 07:19
文字列のサイコロ符号化(速度度外視)
# Usage: ruby convert.rb FILE
require 'zlib'
# サイコロの組み合わせ数
N = (2 + 4 + 4 + 2 + 2 + 4) * 3
def num2num_ary(num, base)
num_ary = []
while num != 0
@long-long-float
long-long-float / gist:8229bbfdcb7527f9ff26
Last active August 29, 2015 14:02
niconico-anywhereのクライアント(ブックマークレット)
(function(){var c,messages,messages_buf,wheight,wwidth;c=function(a,b){var e;e=document.createElement('script');e.type='text/javascript';e.src=a;if(b){e.onloadDone=false;e.onload=function(){e.onloadDone=true;return b()};e.onReadystatechange=function(){if(e.readyState==='loaded'&&!e.onloadDone){e.onloadDone=true;return b()}}}if(typeof e!=='undefined'){return document.getElementsByTagName('head')[0].appendChild(e)}};messages_buf=[];c('https://cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js',function(){var b,_ref;b=io.connect("http://"+((_ref=window.niconico_anywhere_host)!=null?_ref:"niconico-learning.herokuapp.com:80"));return b.on('new-message',function(a){return messages_buf.push(a)})});messages=[];wwidth=document.documentElement.clientWidth;wheight=document.documentElement.clientHeight;setInterval((function(){var a,i,index,msg,remove_list,s,_i,_j,_k,_len,_len1,_len2,_ref,_results;for(_i=0,_len=messages_buf.length;_i<_len;_i++){msg=messages_buf[_i];a=document.createElement('div');s=a.style;s
@long-long-float
long-long-float / compile-and-compressed
Last active December 22, 2015 13:49
自動でフォームを埋めるブックマークレット
javascript:(function(){var d;d=function(a,b){var e;e=document.createElement('script');e.type='text/javascript';e.src=a;if(b){e.onloadDone=false;e.onload=function(){e.onloadDone=true;return b()};e.onReadystatechange=function(){if(e.readyState==='loaded'&&!e.onloadDone){e.onloadDone=true;return b()}}}if(typeof e!=='undefined'){return document.getElementsByTagName('head')[0].appendChild(e)}};d('//code.jquery.com/jquery-1.11.1.min.js',function(){var c,words;words=['hoge','fuga','piyo'];c=function(b){var i;return((function(){var a,_results;_results=[];for(i=a=1;1<=b?a<=b:a>=b;i=1<=b?++a:--a){_results.push(words[Math.floor(Math.random()*words.length)])}return _results})()).join(" ")};$('input').each(function(){var a,month,now,today;switch($(this).attr('type')){case'text':return $(this).val(c(3));case'number':return $(this).val(1);case'date':now=new Date();a=("0"+now.getDate()).slice(-2);month=("0"+(now.getMonth()+1)).slice(-2);today=now.getFullYear()+"-"+month+"-"+a;return $(this).val(today);case'radio':return $(th
@long-long-float
long-long-float / gist:11046484
Created April 18, 2014 14:17
rendering self in ejs
<script src="ejs.js"></script>
<script>
var unescapeHTML = function(str){
return str.replace(/&lt;/g, '<').replace(/&gt;/g, '>')
.replace(/&amp;/g, '&');
};
document.body.innerHTML = new EJS({text: unescapeHTML(document.body.innerHTML)}).render();
</script>
@long-long-float
long-long-float / gist:9311734
Created March 2, 2014 18:59
memory leak(win32 api)
#include <windows.h>
#include <cstring>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]){
while(true) {