Skip to content

Instantly share code, notes, and snippets.

View h1ddengames's full-sized avatar
🍉

Shahid Karim h1ddengames

🍉
View GitHub Profile
@h1ddengames
h1ddengames / PlayerInputModule.cs
Last active March 26, 2020 20:59
Unity Better Keyboard Listener
// Created by h1ddengames
// Attributes being used within this class require:
// https://github.com/dbrizov/NaughtyAttributes
using System.Collections.Generic;
using UnityEngine;
using NaughtyAttributes;
using UnityEngine.Events;
namespace h1ddengames {
@h1ddengames
h1ddengames / AutomatedTaskRunner.cs
Created March 26, 2020 20:58
Unity Automated Task Runner
// Created by h1ddengames
// Attributes being used within this class require:
// https://github.com/dbrizov/NaughtyAttributes
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using NaughtyAttributes;
using ReorderableListAttribute = NaughtyAttributes.ReorderableListAttribute;
@h1ddengames
h1ddengames / AnimationModule.cs
Created March 26, 2020 21:04
Unity 2D Character Controller
// Created by h1ddengames
using System;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
namespace h1ddengames {
[Serializable]
public class AnimationModule {
@h1ddengames
h1ddengames / EntityStats.cs
Last active May 7, 2020 06:35
Gross Misuse of C# Generics
// Created by h1ddengames
using System;
using System.Collections.Generic;
namespace h1ddengames {
[Serializable]
public class ImprovedEntityStats {
public Stat<int> hp;
public Stat<int> mp;
@h1ddengames
h1ddengames / SerializationTool.cs
Created May 7, 2020 06:33
Save Data as JSON using Odin Serializer
// Created by h1ddengames
using System;
using System.IO;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
using Sirenix.Serialization;
namespace h1ddengames {
@h1ddengames
h1ddengames / Tools.cs
Last active May 18, 2020 03:46
Extension and Helper Methods
// Created by h1ddengames
using System;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using System.Text;
using System.Threading;
using Random = System.Random;
using System.Globalization;
import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Tools {
public void combineFiles(File fileInput, File fileOutput) throws IOException {
BufferedWriter writer = new BufferedWriter(new FileWriter(fileOutput));
BufferedReader reader = new BufferedReader(new FileReader(fileInput));
String line;
@h1ddengames
h1ddengames / log4j.properties
Created May 20, 2020 03:45
Log4j Properties
# Root logger
# console and file are just names.
log4j.rootLogger=INFO, console, file
# Example: [INFO - main] 2020-05-19 20:37:57 xyz.hiddengames.Base.Test:12 - Hello
# %-4p -> INFO (Log Level)
# %t -> main (The calling thread)
# %d{yyyy-MM-dd HH:mm:ss} -> 2020-05-19 20:37:57
# %C.%M:%L -> xyz.hiddengames.TestClass:9 (Calling Class + Method Name + Line Number) (ALL ARE SLOW -- REMOVE IF SPEED IS REQUIRED)
# %l -> xyz.hiddengames.TestClass.loggerTest(TestClass.java:9) (Same as above but slower)
@h1ddengames
h1ddengames / $Instructions.md
Last active May 20, 2020 19:36
Storing login and other data securely in a properties file

Storing login and other data in a properties file

Unencrypted storing of properties

  1. Create a properties file template that stores all the data keys your application will use -- you can leave it blank after the equal sign or fill in garbage data.
  2. Create another properties file that contains the same data keys as the template but the actual values your application will use.
  3. Make sure to add the app.properties file to gitignore to prevent adding the file to your repository.

Encrypted storing of properties

  1. Create a properties file template that stores all the data keys your application will use -- you can leave it blank after the equal sign or fill in garbage data.
  2. Create another properties file that contains the same data keys as the template but the actual values your application will use.
@h1ddengames
h1ddengames / ImageReader.java
Last active July 4, 2020 06:50
Using Tesseract OCR, convert an image into the string of letters and words found in the image.
package xyz.hiddengames.core;
import net.sourceforge.tess4j.Tesseract;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;