Skip to content

Instantly share code, notes, and snippets.

View robot9706's full-sized avatar
🐢

Bence robot9706

🐢
  • Hungary
View GitHub Profile
@robot9706
robot9706 / UBI attach
Created August 15, 2018 20:48
How to mount an UBI image
#http://www.linux-mtd.infradead.org/faq/ubi.html
#sudo apt-get install mtd-tools
#sudo -i
#UBI mount
mknod /dev/mtd0 c 90 0
modprobe nandsim first_id_byte=0x2c second_id_byte=0xac third_id_byte=0x00 fourth_id_byte=0x15
dd if=ubi.img of=/dev/mtd0 bs=2048
@robot9706
robot9706 / Caesar.asm
Last active April 27, 2018 17:59
A school assignment. Caesar cipher in x86 32bit assembly.
INCLUDE Irvine32.inc
ExitProcess proto,dwExitCode:dword
; Adat
.data
Str_Mode DB "Kodolas vagy dekodolas? K/D ", 0
Str_Shift DB "Eltolas? ", 0
Str_Code DB "Szoveg? ", 0
Str_Result DB "Kimenet: ", 34, 0 ; 34 = "
Str_Quote DB 34, 0 ; Egy idézőjel
@robot9706
robot9706 / DebugVCPP.cpp
Created March 26, 2018 15:20
A snippet which waits for the debugger to attach then it breaks the application (VC++, Win32)
while (!::IsDebuggerPresent())
::Sleep(100);
::DebugBreak();
#ifdef DEBUG
#include "OutputInterceptor.h"
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
@robot9706
robot9706 / Extensions.cs
Created February 1, 2018 18:25
Simple MonoGame helpers
using Microsoft.Xna.Framework;
namespace Tools
{
public static class Extensions
{
public static float DeltaTime(this GameTime time)
{
return (float)time.ElapsedGameTime.TotalSeconds;
}
@robot9706
robot9706 / Physics.cs
Created February 1, 2018 12:44
2D simple collision
private void UpdatePhysics(float dt, ref Vector2 position)
{
//Update velocity
Velocity += Map.Gravity * dt;
Velocity.X = MathHelper.Clamp(Velocity.X, -Map.MaxVelocity.X, Map.MaxVelocity.X);
Velocity.Y = MathHelper.Clamp(Velocity.Y, -Map.MaxVelocity.Y, Map.MaxVelocity.Y);
//Check collision
float corr;
@robot9706
robot9706 / Display.ino
Created December 3, 2017 14:19
7 segment display controller using a HT16K33
//Components required:
//HT16K33
//4 digit 7 segment display
//"Rotary encoder" (the 2 button version)
//Some pullup/down resistors for the display the the encoder
//Runs on: ATmega328 based boards
#include <ht16k33.h>
@robot9706
robot9706 / manifest.xml
Created November 15, 2017 09:59
GPG Leaderboard/Achievement UI manifest code
<activity android:name="com.google.games.bridge.NativeBridgeActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
@robot9706
robot9706 / AML.cs
Last active November 12, 2017 22:32
AML opcodes in a C# structure
//Based on the ACPICA source code (https://github.com/acpica/acpica)
namespace ASLTest.AML
{
class OpCode
{
public string Name;
public ParseArgFlags[] ParseArgs;
public InterpreterArgFlags[] RuntimeArgs;
public ObjectTypeEnum ObjectType;
@robot9706
robot9706 / PDNLayer.cs
Last active September 12, 2017 14:09
Save PDN layer as PNG
//Required assemblies:
//PaintDotNet.Base
//PaintDotNet.Core
//PaintDotNet.Data
using PaintDotNet;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;