Skip to content

Instantly share code, notes, and snippets.

View math2001's full-sized avatar

Mathieu PATUREL math2001

View GitHub Profile
@math2001
math2001 / demos.md
Last active October 27, 2020 07:16
demos

I wanted to learn how to do isometric rendering:

isometry

And I wanted to learn about A* (how do you get out of a maze, quickly)

maze-iso

I wanted to learn how to make multiplayer games (running over TCP):

Can a function z = f(x, y) have an inverse (x, y, z in R)

Surface points with distinct heights

If we think of z = F(x, y) as describing a surface, then this question translates to asking:

Can one find a continuous surface for which every distinct point on that surface has a unique height

with(LinearAlgebra)
a := <vector A>
b := <vector B>
solve(Equate(a, b))

Keybase proof

I hereby claim:

  • I am math2001 on github.
  • I am math2001 (https://keybase.io/math2001) on keybase.
  • I have a public key ASCzjxjUj_-ujbKB9g5mjtFSR3vYtbkUTpa1GYbcV1AWJQo

To claim this, I am signing this object:

@math2001
math2001 / oop.py
Created September 23, 2018 06:42
Oriented object programmation explained
# We are going to use an analogy of building houses to understand OOP.
# A class is like the plan/design of the house. It's the theory, nothing concrete.
# Our house has different properties (such as the colour, the number of doors, etc), these are called attributes.
# Our house has different behaviours (such as starting the alarm, locking every doors, etc), these are called methods.
# An instance, however, is the real thing. From one plan, one design, one *class*, we can make as many actual houses as we like
# And we can change them. For example, one house (an instance), might have 2 doors, where as an other one might have 4 doors.
# But they still have the same plan
@math2001
math2001 / pinglan
Created July 7, 2018 09:00
Ping every ip on the local network
#! /usr/bin/sh
trap 'exit' SIGINT
for i in `seq 254`; do
(ping 192.168.1.$i -c 1 -w 1 > /dev/null && echo 192.168.1.$i)&
done
wait
@math2001
math2001 / Usage.md
Created April 26, 2018 02:35
Possibly the simplest version of a chat server made with Python

You can build a client in Python if you feel like it, but you might as well just use telnet:

$ telnet localhost 9877
@math2001
math2001 / cookie.js
Created February 2, 2018 07:01
Set cookie on the whole site forever from JavaScript
var copyToClipboard = (function () {
const textarea = document.createElement('textarea')
// hide the textarea (since we can't use display: none, it's a bit long)
textarea.style.opacity = 0
textarea.style.width = 0
textarea.style.height = 0
textarea.style.position = 'absolute'
textarea.style.bottom = '-100%'
textarea.style.left = '-100%'
@math2001
math2001 / add-path-windows.md
Created June 24, 2017 06:24
How do I add a path to your PATH environment variable on Windows?

How do I add a path to your PATH environment variable on Windows?

  1. Open the Control Panel.
  2. Go to System and Security.
  3. Go to System.
  4. On the left, click on Advanced system settings (you need to have administrator privileges to do so)
  5. Click on Environment Variables
  6. Click on Path in the top box
  7. Click Edit