Skip to content

Instantly share code, notes, and snippets.

View libertylocked's full-sized avatar

libertylocked

View GitHub Profile
@libertylocked
libertylocked / Primitives2D.cs
Last active February 14, 2022 12:02
MonoGame Primitives2D (Fixed pixels offset for DrawLine)
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace C3.XNA
{
/// <summary>
/// </summary>
public static class Primitives2D
@libertylocked
libertylocked / ledstars.py
Created January 20, 2016 07:17
Use LEDs to show wanted level in GTAV with Raspberry Pi
# You need to run VStats plugin and server
# See https://github.com/LibertyLocked/VStats
import RPi.GPIO as GPIO
import time
import urllib2
import json
led0=17
led1=18
@libertylocked
libertylocked / FpsCounter.cs
Last active February 20, 2016 08:35
[XNA] FPS counter with multiple features. Published under MIT license.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
@libertylocked
libertylocked / fibonacci.asm
Created February 7, 2015 05:34
Fibonacci function in MIPS
.data
prompt1: .asciiz "Enter the sequence index\n"
prompt2: .asciiz "The Fibonacci value is:\n"
.text
# Print prompt1
li $v0, 4
la $a0, prompt1
syscall
@libertylocked
libertylocked / DlbDictionary.java
Created February 2, 2015 20:57
De la Briandais trie implementation of DictionaryInterface
import java.util.*;
public class DlbDictionary implements DictionaryInterface
{
// Constants
private final char TERMINATE_CHAR = '.'; // set this to whatever, but can't be a letter within English alphabet
// Fields
Node rootNode; // points to the 1st node on the 1st level. It does not have any peers, and only 1 child node
/**
@libertylocked
libertylocked / mygetline.c
Last active August 29, 2015 14:14
coe 449 lab 3
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// YOU FILL IN THE CODE BODY FOR THIS FUNCTION BELOW MAIN
char * mygetline( char **buffer, FILE * instream ); // JUST A PROTOTYPE. FUNCTION BODY IS BELOW MAIN
// MAIN IS GIVEN AS-IS DO NOT MODIFY
int main( int argc, char *argv[] )
@libertylocked
libertylocked / project-1.c
Created January 25, 2015 21:32
COE 449 project 1
/*
project-1.c
As you develop and test this file:
use this command to compile: (you can name the executable whatever you like)
gcc -W -Wall -Wextra -O2 project-1.c -o project-1.exe
use this command to execute: (you will of course test on both input files)
import java.util.Random;
public class ShowPath
{
public static void main(String[] args)
{
int point = 0;
BinaryNodeInterface<Character> root = generateTree();
/**
* It is okay to use ArrayList class but you are not allowed to use any other
* predefined class supplied by Java.
*/
import java.util.ArrayList;
public class CompressDecompress
{
/**
* Get a string representing a Huffman tree where its root node is root
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Counter2bit is
Port ( Up, CLR : in STD_LOGIC;
Q : out STD_LOGIC_VECTOR(1 downto 0));
end Counter2bit;