Skip to content

Instantly share code, notes, and snippets.

// Bind canvas to listeners
var canvas = document.getElementById('canvas');
canvas.addEventListener('mousedown', mouseDown, false);
canvas.addEventListener('mousemove', mouseMove, false);
canvas.addEventListener('mouseup', mouseUp, false);
var ctx = canvas.getContext('2d');
ctx.lineWidth = 5;
ctx.lineJoin = 'round';
ctx.lineCap = 'round';

Hi I'm Tariq 👋
I'm interested in infrastructure as code, serverless, dev ops, and all things cloud-related.
For programming,I usually work in Nodejs/Javacrript/Typescript.

You can find more info about me on my blog;

@tariqazmat101
tariqazmat101 / gist:3b82dd2ece6ed7a20ee7ca23c970a949
Created June 18, 2020 11:23
Replay Recorder Archecture feature
If you're reading this then there is a good chance you are interested in building something similar or are simply a laymen who wants to really understand how this feature works(can't blame you, it's pretty cool :D). Just note, this analysis provides a high level overview of all the systems along with a bit of technical sprinkling. IT DOES NOT TELL YOU HOW TO BUILD IT,
Because this analysis will also cater to the laymen, I will need to explain a few things that the developer may already know. skip this section if you're a seasoned ogar dev.so let's star:
1)The client-server model
the server is just a computer somehwre in the world that evryone connects to, as you may probably know,there is server out here in the world that every player connects to. the server sends data messages to the client
2) the client
You can think of the client
# For the benefit of emacs users: -*- shell-script -*-
###########################
# xbindkeys configuration #
###########################
#
# Version: 1.8.6
#
# If you edit this file, do not forget to uncomment any lines
# that you change.
# The pound(#) symbol may be used anywhere for comments.
@tariqazmat101
tariqazmat101 / .md
Last active June 26, 2019 05:54
Proposal

Issue: Mischievous players joining through vpn,posting sensitive/inappropriate info in chat, and quickly leaving before a mod can successfully ban/kick them.

Solution: The server already maintains a log of all the ip addresses that connect to it, all we have to do is map the the player name with the ip address and log the time when the ip address is connected to the server. so somthing like: "Spectator59 192.168.2.1 22:14 June 13"

The mods can then inform noshu via dc on the in-game username of the troll, and he can then ban that specific ip adress. Of course, the troll could always get another vpn, but that requires effort, and I believe the effort required to setup a new vpn far outweighs the reward.

Improved solution(just thought about this): Mods gain the ability to ipban players that have already left the game x minutes ago.

/*
Javasript to handle mouse dragging and release
to drag a string around the html canvas
Keyboard arrow keys are used to move a moving box around
Here we are doing all the work with javascript and jQuery. (none of the words
are HTML, or DOM, elements. The only DOM element is just the canvas on which
where are drawing and a text field and button where the user can type data
This example shows examples of using JQuery
/*
Here we are prepared to receive a POST message from the client,
and acknowledge that, with a very limited response back to the client
*/
/*
Use browser to view pages at http://localhost:3000/canvasWithTimer.html
When the blue cube is moved with the arrow keys, a POST message will be
sent to the server when the arrow key is released. The POST message will
/*
Javasript to handle mouse dragging and release
to drag a string around the html canvas
Keyboard arrow keys are used to move a moving box around
Here we are doing all the work with javascript and jQuery. (none of the words
are HTML, or DOM, elements. The only DOM element is just the canvas on which
where are drawing and a text field and button where the user can type data
This example shows examples of using JQuery