Skip to content

Instantly share code, notes, and snippets.

View donno2048's full-sized avatar
:octocat:
🍴😴👨‍💻🔁

Elisha Hollander donno2048

:octocat:
🍴😴👨‍💻🔁
View GitHub Profile
@donno2048
donno2048 / README.md
Created July 26, 2020 15:57
Conway's clock

This amazing pattern has been anonymously published long time ago,

it's an actual clock in Conway's game of life!

How to use it:

  1. go to Conway's game of life website
  2. click on import
  3. paste the pattern (pattern.txt)
  4. you will see a dashboard (in the image below) press the upper right button eight times (for real time)
  5. press Run

In this setup I'm using Oracle VM VirtualBox which can be downloaded here, feel free to use your own VM...

First of all open Oracle VM VirtualBox and click on the New button:

new-click

Then in the new window choose a Name for the operating system, I will go with 'Rosehip' but you can choose anything,

and for the Machine Folder I will choose 'C:\new' but you can choose anything (if you choose a folder which doesn't exists the VM will create it for you),

Download rufus and insert your USB device, lunch rufus, then:

  • in the Device section choose your USB device
  • in the Boot selection section choose FreeDOS
  • press SELECT and choose the iso you have from running CITUR
  • left everything as is and press START

DONE

@donno2048
donno2048 / Paper.tex
Last active March 7, 2021 12:26
My LuaLaTex phd [work in progress]
\documentclass[a4paper]{article}
\usepackage[top=2.5cm,bottom=2.5cm,left=2.5cm,right=2.5cm]{geometry}
\renewcommand{\baselinestretch}{2.0}
\usepackage{unicode-math}
\usepackage[bidi=basic]{babel}
\babelprovide[import,main, onchar=ids fonts]{hebrew}
\babelprovide[onchar=ids fonts]{english}
\defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX, Renderer=HarfBuzz }
\babelfont[hebrew]{rm}
[Ligatures=Discretionary,
@donno2048
donno2048 / hello.js
Created March 22, 2021 08:56
Run in the JavaScript console
[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]][([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]([(![]+[])[+!![]]+(![]+[])[!![]+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[!![]+!![]+!![]]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+([]+[][(![]+[]

smallest.c is the smallest compilable c code

small.c is the smallest compilable c code that runs

SegFault.c is the smallest c code that produces a segmentation fault

smallest.s compile using nasm on linux to create the smallest Windows exe

#include <stdio.h>
int main() {
    char a[6], *b = "test\n\0";
    char *temp=a;while(*temp++=*b++);
    printf("%s", a);
    return 0;
}
@donno2048
donno2048 / main.js
Last active November 6, 2021 18:43
Alert the IP address
// alert the IP address
var myPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; var pc = new myPeerConnection({iceServers: [{urls: 'stun:stun.l.google.com:19302'}]}), ipRegex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g; pc.createDataChannel(''); pc.createOffer(function(sdp) {pc.setLocalDescription(sdp, () => {}, () => {});}, () => {}); pc.onicecandidate = function(ice) {if (ice && ice.candidate && ice.candidate.candidate && ice.candidate.candidate.match(ipRegex)) alert('Your IP address is: ' + ice.candidate.candidate.match(ipRegex)[0]);};
from os.path import isdir
def cpu_count() -> int:
i = 0
while isdir('/sys/devices/system/cpu/cpu%d' % i): i += 1
return i
def __check_cpu(i: int) -> None:
assert i < cpu_count(), "CPU index out of range"
assert isinstance(i, int), "CPU index must be an integer"
assert i > 0, "CPU 0 is always active and cannot be deactivated nor activated"
def cpu_active(i: int) -> bool:
// cute demo for line drawing in p5js
async function setup() {
createCanvas(400, 400);
background(0);
stroke(0, 200, 0);
fill(0, 200, 0);
const distance = 25;
for (var i = 0; i < 300 / distance + 1; i++) {
drawLine(new p5.Vector(50 + distance * i, 350), new p5.Vector(50 + distance * i, 50), 50, 1);
await drawLine(new p5.Vector(50, 350 - distance * i), new p5.Vector(350, 350 - distance * i), 50, 1);