Skip to content

Instantly share code, notes, and snippets.

View ratozumbi's full-sized avatar

Bruno Willian Andrade ratozumbi

View GitHub Profile
@ratozumbi
ratozumbi / main.cpp
Created February 1, 2016 02:58 — forked from skhaz/main.cpp
Steganography
#include <QtDebug>
#include <QImage>
#include <QString>
#include <QBitArray>
#include <QByteArray>
#include <QFile>
#include <QCommandLineParser>
namespace {
enum { headerSize = 32 };
@ratozumbi
ratozumbi / PlayOnEditor.cs
Created May 10, 2019 18:53
Preview Video on Unity Editor
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Video;
//Attach this script to a GameObject
[ExecuteInEditMode]
@ratozumbi
ratozumbi / hash_compare_files.py
Created May 28, 2020 17:55
python script that hashes files recursively then compare each one to find duplicates
import hashlib
import os
def getHashes(path, fileHashes):
print("executing in "+ path)
for filename in os.listdir(path):
fullpath = os.path.join(path,filename)
if os.path.isfile(fullpath):
@ratozumbi
ratozumbi / sqlite_variables.sql
Last active February 2, 2021 00:01
How to use variables in SQLite
PRAGMA temp_store = 2;
CREATE TEMP TABLE _Variables(Name TEXT PRIMARY KEY, RealValue REAL, IntegerValue INTEGER, BlobValue BLOB, TextValue TEXT);
/*pergunta 1 linha 3*/
insert into main.pergunta (descricao, dificuldade, cod_quiz, cod_especialidade) values ('Podemos utilizar o cateter Power PICC® para infusão de contraste?', 1, 1, 7);
/* Declaring a variable */
INSERT INTO _Variables (Name, IntegerValue) VALUES ('pergunta_id',(SELECT last_insert_rowid()) );
-- UPDATE _Variables SET IntegerValue = (SELECT last_insert_rowid()) WHERE Name = 'pergunta_id';
@ratozumbi
ratozumbi / PrintManager.cs
Created March 24, 2021 06:31
Save webcam with grayscale filter and alpha blend
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Fotoprint
{
public class PrintManager : MonoBehaviour
{
@ratozumbi
ratozumbi / AutodetectPorts.cs
Created May 17, 2021 03:02
Autodetect Arduino board on Windows
using Microsoft.Win32;
using System.Collections.Generic;
using System.IO.Ports;
namespace SerialManagement
{
public static class AutodetectPorts
{
public class ArduinoPort
{
@ratozumbi
ratozumbi / TextureFormatCheck
Created September 2, 2022 20:12
Check valid TextureFormat for current platform Unity3D C#
var types = Enum.GetValues(typeof(TextureFormat));
try
{
foreach (var type in types)
{
if(SystemInfo.SupportsTextureFormat((TextureFormat)type))
Debug.Log(Enum.GetName(typeof(TextureFormat),type));
}
@ratozumbi
ratozumbi / PixelManipulation.cs
Created September 5, 2022 19:05
Alpha blend, gray scale and sepia
public Texture2D ToGrayScale(Color[] cArr)
{
var bottomPixelData = cArr;
int count = bottomPixelData.Length;
var resultData = new Color[count];
for(int i = 0; i < count; i++)
{
Color bottomPixels = bottomPixelData[i];
Color temp = new Color(
(1f-bottomPixels.r),
@ratozumbi
ratozumbi / SerializableDictionary.cs
Created September 16, 2022 18:16
WIP serializable dictionary
#nullable enable
using System;
using System.Collections.Generic;
using UnityEngine;
public interface ISerializableDictionaryKey
{
public ISerializableDictionaryKey GetNewKey();
}
@ratozumbi
ratozumbi / SeriDic.cs
Created September 22, 2022 15:06
Fake serializable dictionary
//credits: https://forum.unity.com/threads/finally-a-serializable-dictionary-for-unity-extracted-from-system-collections-generic.335797/
[Serializable]
public class MyDictionaryEntry
{
public GameObject key;
public float value;
}
[SerializeField]