Skip to content

Instantly share code, notes, and snippets.

@Meshiest
Meshiest / godot multiplayer.md
Last active April 16, 2024 21:32
overview of how I understand godot multiplayer

Godot 4 Scene Multiplayer

I'm too lazy to write this as official documentation so I'm transcribing my experiences here for reference.

This is high level and does not cover how to setup your peer, only how to use the API itself.

This is not a tutorial.

If you are just getting started, this tutorial by DevLogLogan is worth watching.

@aunyks
aunyks / erc721-example.sol
Last active April 12, 2024 00:56
My implementation of the ERC721 token standard. WARNING: THIS CODE IS FOR EDUCATIONAL PURPOSES. DO NOT DEPLOY TO THE NETWORK.
pragma solidity ^0.4.19;
contract ERC721 {
string constant private tokenName = "My ERC721 Token";
string constant private tokenSymbol = "MET";
uint256 constant private totalTokens = 1000000;
mapping(address => uint) private balances;
mapping(uint256 => address) private tokenOwners;
mapping(uint256 => bool) private tokenExists;
mapping(address => mapping (address => uint256)) private allowed;
mapping(address => mapping(uint256 => uint256)) private ownerTokens;
@viktorbijlenga
viktorbijlenga / htaccess-redirect-load-images-from-production
Last active April 13, 2023 11:55 — forked from rxnlabs/htaccess-redirect-load-images-from-production
htaccess - Redirect image and file request from the localhost to the production host - Wordpress
# Place on top of Wordpress own redirect rules
# If a file (-f) or directory (-d) doesn't exist on the local host,
# A 302 redirect request is made to the production host.
<IfModule mod_rewrite.c>
RewriteEngine On
#Redirect WordPress uploads
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
@crittermike
crittermike / ExampleModuleController.php
Last active June 17, 2021 12:55
Example of overriding a route controller in Drupal 8
<?php
/**
* @file
* Contains \Drupal\example_module\Controller\ExampleModuleController.
*/
// THIS FILE BELONGS AT /example_module/src/Controller/ExampleModuleController.php
namespace Drupal\example_module\Controller;
@ifthenelse
ifthenelse / gist:7925614
Created December 12, 2013 09:53
Impostazioni di esportazione dei dump mySQL di phpMyadmin
Tabella
@SERVER@-@DATABASE@-@TABLE@-%Y%m%d-%H%M%S
Database
@SERVER@-@DATABASE@-%Y%m%d-%H%M%S
Server
@SERVER@-%Y%m%d-%H%M%S
@creationix
creationix / GamePad-TinyDuino.md
Last active January 12, 2019 01:29
A sample program showing how to control a tiny arduino using a gamepad, linux, node.js, and firmata. https://www.youtube.com/watch?v=XjCsDosGghA

Instructions

  • npm install johnny-five
  • Plug in Logitech Gamepad to linux laptop
  • plug in tinyduino with lightring shield.
  • run sudo node move.js
  • move the gamepad to see lights move.
// Reads accel data and logs to serial. then flashes lights. When x is level, it goes faster.
#include <Wire.h>
#define BMA250_I2CADDR 0x18
#define BMA250_RANGE 0x03 // 0x03 = 2g, 0x05 = 4g, 0x08 = 8g, 0x0C = 16g
#define BMA250_BW 0x08 // 7.81Hz (update time of 64ms)
int AccelX;
int AccelY;
@tylerneylon
tylerneylon / learn.lua
Last active April 28, 2024 22:23
Learn Lua quickly with this short yet comprehensive and friendly script. It's written as both an introduction and a quick reference. It's also a valid Lua script so you can verify that the code does what it says, and learn more by modifying and running this script in your Lua interpreter.
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
@fcalderan
fcalderan / perftest.sh
Last active March 8, 2017 14:37
A small bash utility for testing slower connection. Use chmod +x perftest.sh to make the script executable. Thanks to Matteo Rosati for sharing basic commands
#!/bin/sh
CMD="$1"
RATE="$2"
DELAY="$3"
if [ "$RATE" = "" ] ; then
RATE=500
fi
if [ "$DELAY" = "" ] ; then
var msg = JSON.stringify( state );
var getUTF8Size = function( str ) {
var sizeInBytes = str.split('')
.map(function( ch ) {
return ch.charCodeAt(0);
}).map(function( uchar ) {
// The reason for this is explained later in
// the section “An Aside on Text Encodings”
return uchar < 128 ? 1 : 2;