Skip to content

Instantly share code, notes, and snippets.

View m3chanical's full-sized avatar
🧀
definitely asleep

human m3chanical

🧀
definitely asleep
View GitHub Profile
@m3chanical
m3chanical / forkexec.s
Last active January 14, 2019 20:58
compile: nasm -f elf64 -g forkexec.s && ld -s -o forkexec forkexec.o
section .text
global _start
_start:
mov rax, 58 ; 58 --> vfork. No parameters
syscall ; summon it up
cmp rax, 0 ; check fork return: (pid == 0) -> child; (pid > 0) -> parent; (pid < 0) -> failure
jg _parent ; if pid is greater than zero, we're the parent.
jl _error
@m3chanical
m3chanical / pass.py
Created September 11, 2018 19:12
python random pass gen
import random
print ''.(chr(random.randint(32.126)) for i in range(16))
% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8 Unicode
\documentclass[12pt]{article} % use larger type; default would be 10pt
\usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX)
\usepackage{geometry} % to change the page dimensions
\geometry{letterpaper} % or letterpaper (US) or a5paper or....
\geometry{margin=0.5in} % for example, change the margins to 2 inches all round
\geometry{landscape} % set up the page for landscape
\usepackage{graphicx} % support the \includegraphics command and options
%%% PACKAGES
void JsonifyStr(char * dest, const char ** jsonKey, const char ** jsonFormat, uint8_t numArgs, ...)
{
va_list list;
uint8_t i, j, objEncountered = FALSE;
char formatBuff[8000] = {0};
char tempBuff[8000] = {0};
if (dest == NULL)
{
return;
}
{"thing_one": "value",
"other thing": "whatever",
"events": [
{
<.... stuff here ....>
},
{
<.... stuff here ....>
},
@m3chanical
m3chanical / main.c
Created June 26, 2017 17:54
blinky stm32f4-disc
/****************************************************************************
* INCLUDE FILES *
****************************************************************************/
#include "main.h"
/****************************************************************************
* PRIVATE TYPES and DEFINITIONS *
****************************************************************************/
typedef enum
{
/****************************************************************************
* INCLUDE FILES *
****************************************************************************/
#include "main.h"
/****************************************************************************
* PRIVATE TYPES and DEFINITIONS *
****************************************************************************/
typedef enum
{
@m3chanical
m3chanical / classstuff.py
Created January 19, 2016 15:55
Just some interesting things about Python learned in class
# Fancy ways to do things in Python that are not common. It's neat.
#
# "Pythonic" way to modify values in a list:
mylist = [8, 23, 99, 4, 61]
for index, _ in enumerate(mylist):
mylist[index] *= 10
print mylist
************** DRIVER FILE: **************************
#include <stdio.h>
#include <string.h>
#include "pgm7.c"
#define MAXCHAR 256
int find_TLA(char search[], char match[]); /* prototype of search function */
*****MY CODE*****
boardHolder = new GameObject("Board").transform;
for(int x = -1; x < columns + 1; x++)
{
for(int y = -1; y < rows + 1; x++)
{
GameObject toInstantiate = floorTiles[Random.Range(0, floorTiles.Length)];
if (x == -1 || x == columns || y == -1 || y == rows)