Skip to content

Instantly share code, notes, and snippets.

View terremoth's full-sized avatar
🌄
Open to work. #HireMe

Lucas M. Dutra terremoth

🌄
Open to work. #HireMe
View GitHub Profile
@terremoth
terremoth / mandelbrot.js
Created October 15, 2022 12:34
Mandelbrot Algorithm
let canvas = document.getElementById('universe').getContext('2d')
let atom = (x,y,c) => {canvas.fillStyle = c; canvas.fillRect(x,y,3,3)};
window.CP.PenTimer.MAX_TIME_IN_LOOP_WO_EXIT = 10000;
for (y=1; y < 1000; y++) {
for (x=1; x < 1000; x++) {
dx = (x-500)/200
dy = (y-500)/200
a = dx
@terremoth
terremoth / sum_without_plus_sign.js
Created October 15, 2022 12:32
Sum without "+" operator using bitwise
function soma(first, second) {
while (second != 0) {
var carry = first & second;
first = first ^ second;
second = carry << 1;
}
return first;
@terremoth
terremoth / remove_prohibited.js
Created August 7, 2022 18:22
remove prohibited chars from string
function newName(name) {
return name.toLowerCase().split('').map((char) => {
if(['e','r','t','y','u','i','a','s','k','l','b','n','m'].find(prohibited => prohibited === char)) {
return null;
}
return char;
}).join('');
}
console.log(newName("joãozinho da silva sauro"));
@terremoth
terremoth / access_1_challenge.php
Created August 3, 2022 14:30
access_1_challenge.php
<?php
echo base64_decode(strrev(str_rot13($argv[1]))).PHP_EOL;
@terremoth
terremoth / copyToClipoboardBootstrap3AppendToInput.js
Created July 14, 2022 14:53
Insert a "Copy To Clipoboard" button in the right side of an input on Bootstrap 3 (with font-awesome)
function copyToClipoboardBootstrap3AppendToInput(input) {
var parent = input.parentNode;
var div = document.createElement('div');
div.classList.add('input-group');
var copyBtn = document.createElement('button');
copyBtn.classList.add('btn');
copyBtn.classList.add('btn-default');
copyBtn.setAttribute('type', 'button');
copyBtn.setAttribute('title', 'Click to copy to clipboard');
@terremoth
terremoth / monty_hall.php
Created June 29, 2022 17:43
Monty hall brute force script
<?php
/*
* This script is intended to prove if monty hall paradox is worthy
* to change the user choice to the other 2 from 3 options (guessing the right choice)
* from a TV show where the presenter presents 3 options (let's say A, B or C)
* to the user guess, the user so, chooses one position and then
* the TV presenter says another option that IS NOT the correct, then the user will
* have 2 options: stays with the initial choice or change it to the other one left.
*
* The paradox says that the best choice is to change your initial choice to the other
@terremoth
terremoth / hello_world.py
Created May 31, 2022 02:59
Python Hello World the Worst Way
list(map(lambda x: (__import__('sys').platform.__ne__('\x77\x69\x6e32') and __import__('ctypes').cdll.LoadLibrary('libc.so.6') or __import__('ctypes').cdll.msvcrt).putchar(__import__('ctypes').c_char(__import__('ctypes').cast((__import__('ctypes').c_int64 * 2)(8583909746840200520, 11138535027311), __import__('ctypes').POINTER(__import__('ctypes').c_char))[int(x, 0x10)])), '0123456789abcd')) and None
@terremoth
terremoth / ironicaze.js
Created March 13, 2022 16:18
Makes some text looks ironic
function ironicaze(text) {
return text.split('').map((char, i) => i % 2 == 0 ? char.toLowerCase() : char.toUpperCase() ).join('');
}
@terremoth
terremoth / ascii_table_complete.php
Created January 31, 2022 07:29
PHP print all ascii table 16bits 65535 chars in utf-8
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Supreme ASCII TABLE</title>
<style type="text/css">
html {
font-family: sans-serif;
}
@terremoth
terremoth / batch_compiler.bat
Created January 31, 2022 02:39
Batch compiler to exe simple using iexpress
;@echo off
; rem https://github.com/npocmaka/batch.scripts/edit/master/hybrids/iexpress/bat2exeIEXP.bat
;if "%~2" equ "" (
; echo usage: %~nx0 batFile.bat target.Exe
;)
;set "target.exe=%__cd__%%~2"
;set "batch_file=%~f1"
;set "bat_name=%~nx1"
;set "bat_dir=%~dp1"