Skip to content

Instantly share code, notes, and snippets.

@easyaspi314
easyaspi314 / cppcheck output
Created January 27, 2019 23:03
cppcheck output 2
[pragma.c:4]: (style) The scope of the variable 'bar' can be reduced.
[pragma.c:7]: (style) Variable 'bar' is assigned a value that is never used.
@easyaspi314
easyaspi314 / cppcheck output
Created January 27, 2019 22:44
cppcheck bug
$ cppcheck --enable=style uint128mul.c
Checking uint128mul.c ...
[uint128mul.c:9]: (style) The scope of the variable 'botLo' can be reduced.
@easyaspi314
easyaspi314 / unit.post.clang3.9.c
Created November 25, 2018 16:01
c99conv output unit test 1
# 1 "unit.c"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 360 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "unit.c" 2
@easyaspi314
easyaspi314 / hash_map.c
Last active November 24, 2018 07:57
My failed attempt at a hash map.
/* Copyright (C) 2018 easyaspi314
* MIT license.
* Please don't use this code, it is BAD.
* Use an actual hash map. Please.
*/
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <stdint.h>
@easyaspi314
easyaspi314 / README.md
Last active October 4, 2018 21:03
Overcomplicated ShowNum assignment

ShowNum

A completely overcomplicated way to do my homework assignment.

The assignment

Write a Java class (called ShowNum) that displays the same number of asterisks (row and columns) as is input in 2 numbers. 
Your class should have a default constructor (number1 is 0, number2 is 0) and 
another constructor that inputs 2 numbers (integers). 
You'll need accessor methods for the numbers and a display method that displays as follows:
@easyaspi314
easyaspi314 / OvercomplicatedWayToPrintA5x5Square.java
Last active February 9, 2019 04:41
Java assignment to print a 5x5 square
/* filename: OvercomplicatedWayToPrintA5x5Square.java */
public class OvercomplicatedWayToPrintA5x5Square {
/*
* An abstract class representing a shape that can be printed to the console.
*/
private static abstract class Shape {
/*
* Prints the contents of the shape to the console.
*/
public abstract void printToConsole();
@easyaspi314
easyaspi314 / setup.sh
Last active October 26, 2018 02:33
easyaspi314's agbcc and pokeruby build script for Termux
#!/data/data/com.termux/files/usr/bin/sh
note() {
printf "\033[1m%s\n\033[0m" "$1" >&2
}
die() {
printf "%b\n" <<EOF >&2
\033[31;1mDamn it! \033[0;1m$1
You should be able to find a log in ~/agbcc-build-log.txt.
@easyaspi314
easyaspi314 / README.md
Last active May 30, 2021 17:23
C style void pointer/malloc wrapper for C++

C Style Malloc in C aka Void Pointers

One of the most annoying things about C++ is the incompatibility with C's void * conversion. In C, void * can be cast implicitly to any pointer type, but C++ needs an explicit cast.

Most C code is valid C++ code, but the most common issue is malloc, which returns void *.

For example, this is valid C code, but not valid C++ code:

struct Foo *x = malloc(sizeof(struct Foo));
@easyaspi314
easyaspi314 / orthodoxc++.md
Created July 18, 2018 19:56 — forked from bkaradzic/orthodoxc++.md
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@easyaspi314
easyaspi314 / troll.bbcode
Last active December 21, 2017 20:45
How to break Pokécommunity (and other BBCode forums which allow CSS)
Click and be trolled by the power of unsanitized CSS!
<!--
This shows a troll face that completely covers the screen when you unhide the spoiler.
**** This is mainly a proof of concept; if you actually post this, don't be surprised if mods get angry! ****
Basically, some BBCode-based forums have a [div][/div] or [style][/style] tag which allows custom CSS.
This takes full advantage of that and CSS's position: fixed, which positions the element in relation to the
browser window, not the parent element.