Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
✅
‏‏‎

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / LinuxShell.txt
Last active September 7, 2026 12:25
Linux Shell Cheat Sheet
// LINUX CHEAT SHEET
// firewall, allow port
sudo ufw allow 5001/udp
sudo ufw allow 5001/tcp
// download whole folder recursively:
wget -r --no-parent target[.com/dir
uninstall java:
@unitycoder
unitycoder / centos-security.txt
Last active September 17, 2016 09:34
Securing Centos Linux Server
// https://www.smittix.co.uk/centos-7-server-hardening-guide/
// ============ install Fail2Ban ============
sudo yum install epel-release
sudo yum install fail2ban fail2ban-systemd
sudo nano /etc/fail2ban/jail.d/sshd.local
// copy paste (and edit your settings)
[sshd]
@unitycoder
unitycoder / fixassetbundleshader.cs
Created September 15, 2016 07:32
Fix Pink Shader after instantiating AssetBundle
// after instantiating assetbundle
var go = Instantiate(prefab, Vector3.zero, prefab.transform.rotation) as GameObject;
// fix pink shader
var r = go.GetComponent<Renderer>();
var material = Shader.Find(r.material.shader.name);
r.material.shader=null;
r.material.shader = material;
// NOTE: this does it only for the main gameobject, not children
@unitycoder
unitycoder / minecraft-command-block.txt
Last active September 17, 2016 04:08
Using Minecraft Command Block
Using Minecraft Command Block
- Enable command block from server.properties
- Give ops to player, from ssh> op yourname
- After opped, can get command block with: give yourname command_block 1
- Set to creative (so that can use command block)> gamemode 1
COMMANDS
// spawn villager with specific trades
@unitycoder
unitycoder / CameraLerp.cs
Created September 11, 2016 02:51
Camera Position Lerp With AnimationCurve
using UnityEngine;
using System.Collections;
public class CameraLerp : MonoBehaviour
{
public float duration = 2;
public AnimationCurve speedCurve = AnimationCurve.EaseInOut(0,0,1,1);
void Start()
{
@unitycoder
unitycoder / install-minecraft-linux.txt
Last active October 31, 2023 22:56
Install MineCraft Forge & Mods on Centos Linux (command line)
// =============================================================================
// INSTALL PLUGINS * client can use vanilla minecraft
//Download CraftBukkit
https://getbukkit.org/download/craftbukkit
//Copy and run it on server
java -Xmx2048M -Xms2048M -jar craftbukkit-1.10.2-R0.1-SNAPSHOT.jar -o true
@unitycoder
unitycoder / errors
Created September 6, 2016 09:28
Opening old project in 5.5 Beta
error CS1704: An assembly with the same name `UnityEngine.UI' has already been imported. Consider removing one of the references or sign the assembly
D:/Software/Unity55Latest/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll (Location of the symbol related to previous error)
D:/Software/Unity55Latest/Editor/Data/UnityExtensions/Unity/GUISystem/Standalone/UnityEngine.UI.dll (Location of the symbol related to previous error)
error CS1704: An assembly with the same name `UnityEngine.Networking' has already been imported. Consider removing one of the references or sign the assembly
D:/Software/Unity55Latest/Editor/Data/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll (Location of the symbol related to previous error)
D:/Software/Unity55Latest/Editor/Data/UnityExtensions/Unity/Networking/Standalone/UnityEngine.Networking.dll (Location of the symbol related to previous error)
error CS1704: An assembly with the same name `UnityEngine.HoloLens' has already been imported. Consider removing one
@unitycoder
unitycoder / button_event_listeners.cs
Created September 5, 2016 05:00
Add OnClick listeners to array of buttons or dynamic buttons
adding event listeners to dynamically generated buttons
for (int i = 0, len=objs.Length; i < len; i++)
{
var b = obj[i].GetComponent<Button>();
var temp = i; // needed, if uses just i, all have same value
b.onClick.AddListener(delegate { this.MyButtonAction(temp); }); // calls function with button index value
@unitycoder
unitycoder / AlignToNormal.cs
Last active February 5, 2024 14:08
Raycast Align To Normal on 3D surface
using UnityEngine;
public class AlignToNormal : MonoBehaviour
{
public GameObject prefab;
void Update()
{
if (Input.GetMouseButtonDown(0))
{
@unitycoder
unitycoder / nasa.txt
Created August 24, 2016 02:38
Convert NASA .img files to .PNG (heightmap)
image .img files
http://www.uahirise.org/dtm/index.php?page=4
converter
http://bjj.mmedia.is/utils/img2png/#download
.j2 to .jpg
http://image.online-convert.com/convert-to-jpg