Skip to content

Instantly share code, notes, and snippets.

View Snack-X's full-sized avatar

Snack Snack-X

View GitHub Profile
@Snack-X
Snack-X / upload.js
Last active December 17, 2015 18:19
Simple file upload script written in node.js. Requires node-formidable.
var formidable = require("formidable"),
http = require("http"),
util = require("util"),
fs = require("fs");
http.createServer(function(req, res) {
if(req.url == "/upload" && req.method.toLowerCase() == "post") {
var form = new formidable.IncomingForm();
form.parse(req, function(err, fields, files) {
var util = require("util");
var net = require("net");
var exec = require("child_process").exec;
String.prototype.startsWith = function(prefix) {
return this.indexOf(prefix) === 0;
}
// loadbot config
var _server = "yourserver";
var fs = require("fs");
function to_4(i) { return Math.floor(i * 10000) / 10000; }
// Variables
var CHAR_FREQ = [];
var TOTAL_LINE = 0;
var TOTAL_CHAR = 0;
var TOTAL_KOR_CHAR = 0;
var TOTAL_ENG_CHAR = 0;
@Snack-X
Snack-X / README.txt
Last active August 29, 2015 14:02
rot13 in aheui
아희로 구현된 ROT13입니다.
pyaheui(https://bitbucket.org/lifthrasiir/esotope-aheui/raw/esotope-aheui-5a/esotope-aheui)와 jsaheui(http://jinoh.3owl.com/aheui/jsaheui_ko.html)에서 테스트, 정상 작동을 확인하였습니다.
문장을 입력하면 문장의 ROT13 결과가 출력되며, 인터프리터를 종료하기 전까지 계속해서 작동합니다.
(jsaheui의 경우 개행이 되지 않지만, pyaheui에서는 입력마다 개행이 됩니다.)
@Snack-X
Snack-X / 99bob.aheui
Created June 4, 2014 13:40
99 bottles of beer in aheui
발발따밤따박박나타삭밤밣따산박밦따밞뚜 #기본 스택 99로 초기화, 공백(32)->ㄱ, (l)108->ㄴ
우어어어어어어어어어어어어어어어어어어
아우 #루프의 시작
오사뺘뿌처밞밞따받타맣산빠받다맣삭빠맣산빠박박나다맣빠받다맣빠밦다맣빠밝타맣수 #복제 후, 0일 경우 'No more' 출력 (78 111 32 109 111 114 101) (No more로 변경)
오우어명여어어어어어어어어어어어어어어어어어어어어어어어어어어어어어어어어어어 #0이 아닐 경우 복제 후 숫자로 출력
오삭빠맣산빠발타발타맣빠받다맣빠밣다빠맣맣빠맣빠밝타맣수 #' bottle' 출력 (32 98 111 116 116 108 101)
오우어어어어어어어어어어어어어어멓더벍뻐선처우텨너벅벅뻐 #복제 후, -1이 0이 아닐 경우 's' 출력 (115)
오우어어어어어어어어어어어어어어어어어어어어어
오아삭빠맣산빠받다맣빠밦타맣삭빠맣산빠발타발타맣빠밝타빠맣맣빠밦다맣삭빠맣산빠받다맣빠박다뭏 #' of beer on' 출력 (32 111 102 32 98 101 101 114 32 111 110)
오뭏뻐멓더벖더벖뻐석멓뻐멓뻐멓터벖터벌뻐멓더벖더벌뻐선멓뻐석멓터벍뻐멓터범뻐멓더벓뻐선멓뻐석 #' the wall, ' 출력 (32 116 104 101 32 119 97 108 108 44 32)
@Snack-X
Snack-X / polygot.php
Created June 10, 2014 09:14
Simple polygot POC for PNG and BF
<?php
// 32 ~ 126, 5x7 = 35 pixels
$pixel = gzinflate(base64_decode("lVUJkiMxCPsS/P9zWzMxIAnZk3VVk3abS4CciC9WGsGn+SNHeCfnNH+WvB2z3+d8/H372GW9xec3Y7TnqbNznOgz5nO9j+0DdasA8JayBSGeO5sGbov4SS8L3iu3eEOoin23uqiUjT7jOroJWaBiWlUmbmi6q+3FRutF4ROSPYEmk54iMKttVknGDacL8xSJAKtlmWkzRWHMJND+hk6nAdKP3R6vgp3azduyTLswMjTejuHf2ghZsMqHnyVcXWACaBvvLXtZfDxtbC5yNGxRooNyOtv8Q6VKSbkQmJnRO97O2VJoeHTTyR4pZUji+ZupCLpAQfN2EWNSahVFbmqvVHOdvla3b3284L0XAs2krjwR876Lt7jX4Bu8TX2rMiShiR0zObi6h3RvFxmjfk9DTJ2uMrC2pmw5gSHN/1swHBz7aXIU539C6FyedXxWYLII40R4HuJmYkyATip6XD3DVy7wd+I4o4jAz/hzzbocN9UWH+wt85qF0LLIJZOc7sF67haLiKtLDZDKTQNcbW11RY1zeXuB+UvuqrlpFqAweAWRnm5moQrdL6ICtsbP+rwZjAj7AT6IGTHJTzvP2Tbbp1Uh7Uevfw=="));
$data_text = "Answer to the Ultimate Question of Life, the Universe, and Everything";
$data_hide = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.";
$img_height = 9; // 7 pixel per character + 2 pixel padding
$img_width = strlen($data_text) * 6 + 1; // 5 pixel per character + 1
@Snack-X
Snack-X / number2aheui.js
Last active August 29, 2015 14:02
Convert number to aheui expression
/**
* TODO
* optimize algorithm
* support negative numbers
*/
var readline = require("readline");
var rl = readline.createInterface({input: process.stdin, output: process.stdout, terminal: false});
var cho = {"+": 3, "*": 4, "-": 16, "/": 2, ">": 8};
@Snack-X
Snack-X / validator.js
Created July 14, 2014 03:25
codegolf - make a number expression - validator
var fs = require("fs");
var input = fs.readFileSync("input.txt", "ascii");
var output = fs.readFileSync("output.txt", "ascii");
input = input.split("\n");
output = output.split("\n");
var OK = 0;
for(var i in output) {
@Snack-X
Snack-X / ohgamdo-1.aheui
Created July 17, 2014 13:00
오감도 시제1호
밝밝따맣밝빠따박다맣밝밤따밣따박다빠따밦밦다타맣발발따빠따발다밞따밞따박다맣밞발따빠따발타발따발따맣밞밤따빠따발다밦따밝따박다맣밞빠따발다밣따밣따밣따맣밣밦따빠따받타밤따발따맣밞밣따빠따밣빠따밤타다밞따맣밞밣따빠따밣빠따밤타다밞따맣밞밞따빠따밝밦다밣따타밣따맣밝발따빠따밦따밝따박다맣밝밦다밞따빠따밝발따타밤따맣밣밝다빠따빠따밦발다밞따다맣밝빠따받타맣발발다맣밣발따맣발발따빠따밦타밞따밤다밣따맣밣발따빠따밦타밤따밣따맣밞빠따밣다빠따발다밦따발다맣밦발따밝따밤다빠따맣밞빠따밤타빠따밦다밣따맣밝밤따빠따밦다밝따받다밣따맣밣발따빠따밣타밦따발다발따맣발발따빠따밦타밞따밤다밣따맣밝밤따밣따박다빠따밣밣다타맣밞빠따밦타빠따밣밣따다밞따맣밦발따밝따밤다빠따밝받따다맣밝밦다밞따빠따밝발따타밤따맣밣밝다빠따빠따밦발다밞따다맣밝빠따받타맣밝빠따밣타맣발발다맣발발다맣밣발따빠따밣따밝다밤따맣밝밝따맣발발따빠따발다밞따밞따박다맣밞발따빠따발타발따발따맣밞밤따빠따발다밦따밝따박다맣밞빠따발다밣따밣따밣따맣밞빠따밣타빠따발타밞따밣다맣밝밤따빠따밝따밦다밞따밝다맣밦발따밝따밤다빠따맣밞빠따밝타빠따밣밝따다밣따맣발발따빠따밝타밞따발다밣따맣밣밝다빠따밝타빠따밣다맣밣밝다빠따빠따밦발다밞따다맣밝빠따받타맣발발다맣밣발따빠따밣따밝다밤따맣발밞따발다맣발발따빠따발다밞따밞따박다맣밞발따빠따발타발따발따맣밞밤따빠따발다밦따밝따박다맣밞빠따발다밣따밣따밣따맣밞빠따밣타빠따발타밞따밣다맣밝밤따빠따밝따밦다밞따밝다맣밦발따밝따밤다빠따맣밞빠따밝타빠따밣밝따다밣따맣발발따빠따밝타밞따발다밣따맣밣밝다빠따밝타빠따밣다맣밣밝다빠따빠따밦발다밞따다맣밝빠따받타맣발발다맣밣발따빠따밣따밝다밤따맣밝빠따박다맣발발따빠따발다밞따밞따박다맣밞발따빠따발타발따발따맣밞밤따빠따발다밦따밝따박다맣밞빠따발다밣따밣따밣따맣밞빠따밣타빠따발타밞따밣다맣밝밤따빠따밝따밦다밞따밝다맣밦발따밝따밤다빠따맣밞빠따밝타빠따밣밝따다밣따맣발발따빠따밝타밞따발다밣따맣밣밝다빠따밝타빠따밣다맣밣밝다빠따빠따밦발다밞따다맣밝빠따받타맣발발다맣밣발따빠따밣따밝다밤따맣밝빠따받다맣발발따빠따발다밞따밞따박다맣밞발따빠따발타발따발따맣밞밤따빠따발다밦따밝따박다맣밞빠따발다밣따밣따밣따맣밞빠따밣타빠따발타밞따밣다맣밝밤따빠따밝따밦다밞따밝다맣밦발따밝따밤다빠따맣밞빠따밝타빠따밣밝따다밣따맣발발따빠따밝타밞따발
@Snack-X
Snack-X / index.html
Last active August 29, 2015 14:04
codegolf SE 33569 - try 1
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>35569</title>
</head>
<body>
<canvas id="cv"></canvas>
<script src="script.js"></script>
</body>