Skip to content

Instantly share code, notes, and snippets.

View leomastoras's full-sized avatar
🏠
Working from home

Leo leomastoras

🏠
Working from home
View GitHub Profile
/* Eisagogi ston programatismo - 2014-15 */
/* Askisi 1 */
#include <stdio.h>
#include <time.h>
#define MINNUM 1990000001
#define MAXNUM 2000000000
#define MAXTRIES 10
@leomastoras
leomastoras / sudoku.js
Last active April 20, 2024 18:41
Solve sudoku
// Sudoku solver
let Board = [
['5', '3', '.', '.', '7', '.', '.', '.', '.'],
['6', '.', '.', '1', '9', '5', '.', '.', '.'],
['.', '9', '8', '.', '.', '.', '.', '6', '.'],
['8', '.', '.', '.', '6', '.', '.', '.', '3'],
['4', '.', '.', '8', '.', '3', '.', '.', '1'],
['7', '.', '.', '.', '2', '.', '.', '.', '6'],
['.', '6', '.', '.', '.', '.', '2', '8', '.'],
@leomastoras
leomastoras / takis.2.if.c
Created April 14, 2024 11:47
Takis 2 IF
/* file: indent.c */
#include <stdio.h>
/* MACRO gia na ektiponei X arithmo apo tabs */
#define PRINTTABS(X) do {int i; for(i=0;i<(X);i++) printf("\t");} while(0)
/* 5 diaforetikes katastaseis pou briskete o parser */
#define STATE_NOSPACE 1 /* katastasi whitespace eksoterika ton entolon */
#define STATE_ONESPACE 2 /* katastasi whitespace esoterika mias entolis */
#define STATE_ENTOLI 3 /* katastasi anagnosis entolis */
/* ----------------------------------------------------------------
*
* University of Athens
* Department of Informatics and Telecommunications
* --------------------------------
* Class: Object Oriented Programming
* Professor: Izambo Karali
* --------------------------------
* Exercise 1 - Winter semester 2014-2015
* Description: Simulation of public service building
@leomastoras
leomastoras / safe.eval.js
Last active April 20, 2024 19:18
Safe eval ASCII Art
[ ,,,ㅤ]
=
(ᅠ= Reflect )
[ 'ownKeys' ]
(ᅠ)
; ᅠ
ᅠ=ㅤ +=
ㅤ[ᅠ= - ~ {ㅤ} ]
+ '' +
ㅤ[ᅠ +ᅠ <<ᅠ ^ᅠ ]
@leomastoras
leomastoras / ghost.js
Last active April 21, 2024 04:12
JavaScript Invisible Code
// Transforms any text to a zero width string thus
// making it invisible
// Call with 2nd param true to decode invisible text
// into original
// ------------------------------
// masterleo@gmail.com 18/11/2021
const ghost = ($,ǃ) => (($,ǃ,g,h,o,s,t)=>(
[g][g][g]('λ={'+`${[][g](124)}`
[o](/./g,(λ,x)=>λ[g][h](x))
(function play() {
// Code to send: -----------------
((c=new AudioContext(),n=[...'畋畋畍甯畋甯畐甯畏甯甯甯畋畋畍甯畋甯畒甯畐甯甯甯畋畋畗甯畔甯畐畐畏甯畍甯甯甯畕畕畔甯畐甯畒甯畐甯甸甼甿町甽甿町甽甿甸甼甿甸甿畂甸甽畁畄町甿畃甼甿畄'].map(a=>a.charCodeAt(0)-30000),z=c.currentTime,t=(f,b,o=c.createOscillator(),g=c.createGain(),l=0.5)=>(o.frequency.value=f,o.connect(g),g.connect(c.destination),g.gain.setValueAtTime(0.5,z+b),g.gain.linearRampToValueAtTime(0,z+b+l),o.start(z+b),o.stop(z+b+l)))=>n.forEach((c,i)=>~c&&t(220*2**((c)/12),(i>=47?(i-47)*2:i+(i%2)/6)/4)))()
// -------------------------------
})()
/*! JSFuck 0.5.0 - http://jsfuck.com */
(function(self){
const MIN = 32, MAX = 126;
const SIMPLE = {
'false': '![]',
'true': '!![]',
'undefined': '[][[]]',
'NaN': '+[![]]',
@leomastoras
leomastoras / rickroll.invisible.js
Created April 14, 2024 10:59
Invisible JS Rickroll 20/11/2021
rickroll = "[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]
@leomastoras
leomastoras / xorshift128p.js
Last active April 14, 2024 12:04
xorshift128+ random
// what is randomness anyway
const RNG = {
random : () => RNG.xs128p(RNG.pair),
pair : [~-Math.E, ~-Math.PI], // [1,2]
xs128p : ([v, u]) => (
( v ^= v << 23 ), // ~~(Math.E**Math.PI)
( v ^= v >> 17 ), // -~(Math.E<<Math.PI)