Skip to content

Instantly share code, notes, and snippets.

View maxoja's full-sized avatar

Tawan T. maxoja

  • Glasgow, Scotland
View GitHub Profile
@maxoja
maxoja / ImageLoader.cs
Created July 15, 2018 08:09
Unity How to : Load Image from WebLink or URL
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ImageLoader : MonoBehaviour
{
public string url = "https://i.pinimg.com/originals/9e/1d/d6/9e1dd6458c89b03c506b384f537423d9.jpg";
public Renderer thisRenderer;
// automatically called when game started
// ... includes
void scanFloat(float* f)
{
//scan a float value from console to the given address
}
void calculate(float r, float* perimeter, float* area)
{
//calculate the results based on the given r and put them into the specified addresses
// ... includes
void scanValues(int* a, int* b, int* c)
{
}
void sort(int* a, int* b, int* c)
{
// .. includes
void scanValues(int* a, int* b)
{
//use scanf to get 2 input integers into address a and b
}
void conditionalSwap(int* a, int* b)
{
//swap the values if the value in a is bigger than b's
@maxoja
maxoja / MouseDrag.cs
Last active April 29, 2020 02:02
Unity Tutorial Source Code : Drag Object with Mouse
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//this script colaborates to the tutorial
//https://www.youtube.com/watch?v=pK1CbnE2VsI
public class MouseDrag : MonoBehaviour {
float distance = 10;
@maxoja
maxoja / connect_to_mysql.sh
Created November 23, 2018 18:07
Connect to MySql server from terminal
mysql --host=[HOST_IP_OR_DOMAIN] --user=[USERNAME] --password
{
"nodes": [
{
"id": "A",
"group": 1
},
{
"id": "B",
"group": 1
},
@maxoja
maxoja / SpinAround.cs
Created September 29, 2020 18:35
Random but soothing movement Unity C# script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpinAround : MonoBehaviour
{
public float rotX, rotY, rotZ;
public float moveScale;
public Vector3 changeSpeed = Vector3.one;
private Rigidbody rb;
@maxoja
maxoja / server-setup-guide.txt
Created October 28, 2020 02:36
Personal Server Setup Guide [Nginx, SSL, IONOS, GoDaddy, Crontab]
----------------------------------
Domain Parking for IONOS Server
----------------------------------
- Go to domain & ssl section
- Add external domain
- Use Godaddy's name servers
- Add verify record on GoDaddy
- Add A record on GoDaddy linking to the server IP
* Changing DNS Records takes some time to update depending on TTL
@maxoja
maxoja / learning.2020.10.29.txt
Created October 29, 2020 21:18
Edit code on remote server
You can setup VS code to directly access your source code on server through ssh
It's super convenient
You can also do anything on server through VS code's terminal