This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import System | |
| import System.Drawing | |
| import System.Runtime.CompilerServices | |
| class ASCII_logo(): | |
| public shape_font = Font("Sylfaen", 20) | |
| public fill_font = Font("Consolas", 7, FontStyle.Bold) | |
| public text_color = Color.Pink | |
| public bg_color = Color.Black | |
| public noise_color = Color.FromArgb(25, 25, 25) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| day_of_week = (day, month, year) -> | |
| month_len = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] # 0 ? Because jan. | |
| month_len[2] += 1 unless year % 4 or year % 1000 == 0 # 29th february, you know. | |
| unless 0 < month <= 12 # Month boundary check. | |
| throw new RangeError("Month index outside of [1..12] range !") | |
| unless 0 < day <= month_len[month] # Day index boundary check. | |
| throw new RangeError("Day index outside of [1..#{month_len[month]}] range !") | |
| #.---Finally some actual calculations: | |
| dayz = day + # Amount of days passed. | |
| month_len[...month].reduce((a, b) -> a + b) + # Sum(days_in_jan..prev_month) + 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Procedure.s LongToStr(Val.l, Base.a = 10) | |
| #MaxBase = 36; So far. | |
| Define Sign.a, Accum.s{33} | |
| If Base > 1 And Base <= #MaxBase ; If operation ever applicable... | |
| If Val < 0 : Val = -Val : Sign = '-' : EndIf | |
| EnableASM | |
| MOV EAX, Val | |
| MOVZX EBX, Base | |
| LEA ECX, Accum | |
| DivMore: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Macro TranslateChar(Char) | |
| Select Char ; Symbol scanner. | |
| Case ':' To '@' : Char - ':' + 'A' | |
| Case '[' To '`' : Char - '[' + 'a' | |
| Case '.' To 'z' ; NOOP | |
| Default : Char = '.' | |
| EndSelect | |
| EndMacro | |
| Procedure.s Tripcode(Plain.s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Procedure RGB2Gray(RGB) | |
| ! MOVZX EAX, byte [p.v_RGB] | |
| ! MOVZX EBX, byte [p.v_RGB+1] | |
| ! MOVZX ECX, byte [p.v_RGB+2] | |
| ! XOR DX, DX | |
| ! ADD AX, BX | |
| ! ADD AX, CX | |
| ! MOV CX, 3 | |
| ! DIV CX | |
| ProcedureReturn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Macro Def_Comparator(PName, op) | |
| Procedure PName(Alfa, Omega) | |
| ProcedureReturn Alfa + (-Bool(Alfa op Omega) & (Omega - Alfa)) | |
| EndProcedure | |
| EndMacro | |
| Def_Comparator(Max, <) | |
| Def_Comparator(Min, >) | |
| ; --Usage sample-- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Procedure Sign_(Val) | |
| Define Factor.i = Val / Abs(Val), NaN.i = NaN() | |
| ProcedureReturn Factor % NaN | |
| EndProcedure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Yet another clone of http://www.text-image.com/convert/ | |
| Jimp = require('jimp') | |
| class ascii_image | |
| constructor: (@image, @width = 130, char_pool = "01", filters = [], random_chars = true) -> | |
| # Bitmap downscaling. | |
| @height = Math.max(@image.bitmap.height // (@image.bitmap.width / @width * 2.33), 1) | |
| @image.resize(@width, @height) | |
| # Additinal filtering. | |
| for cmd in filters |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| conv = require 'iconv-lite' | |
| # ~/Generic patcher proc/~ | |
| patch866 = (proc, args...) -> | |
| decoder_tmp = (encoding = 'utf8', start, end) -> | |
| Δ866 iconv.decode, new Buffer(@, start, end), encoding | |
| proc_swap = () -> | |
| [Buffer.prototype.toString, decoder_tmp] = [decoder_tmp, Buffer.prototype.toString] | |
| Δ866 = (proc, args...) -> | |
| [proc_swap(), proc(args...), proc_swap()][1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| EventEmitter = require('events') | |
| require('clr').init {assemblies: ['CSCore.dll', 'System', 'mscorlib']} | |
| Δimport = (namespace) -> Object.assign global, namespace | |
| Δexport = (entity) -> module.exports[entity.name] = entity | |
| Function::getter = (name, proc) -> Object.defineProperty @prototype, name, {get: proc, configurable: true} | |
| Function::setter = (name, proc) -> Object.defineProperty @prototype, name, {set: proc, configurable: true} | |
| #- Requires CSCore v.1.2.0+ (https://github.com/filoe/cscore) | |
| Δimport CSCore | |
| Δimport CSCore.Codecs | |
| Δimport CSCore.SoundOut |
OlderNewer