Skip to content

Instantly share code, notes, and snippets.

View Lif3line's full-sized avatar

Adam Hartwell Lif3line

View GitHub Profile
@Lif3line
Lif3line / reclaimWindows10.ps1
Last active January 8, 2017 21:25 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# for Adam Hartwell
@Lif3line
Lif3line / btWake.c
Last active February 6, 2024 12:57
Arduino code to wake up upon interrupt from a bluetooth module and toggle a pin each time (here controlling a relay hence relayPin).
#include <avr/sleep.h>
#include <SoftwareSerial.h>
SoftwareSerial blueSerial(3, 9); // RX, TX pins
int relayActive = false;
int relayPin = 7;
void setup() {
blueSerial.begin(9600); // Set baud rate
pinMode(relayPin, OUTPUT);
@Lif3line
Lif3line / serial.c
Last active August 29, 2015 14:04
C code to open, configure and sit listening to a serial port under Windows. Simply edit the port and its parameters (defaults to COM6, 9600 baud, 8 data bits, no parity checking, no flow control and a single stop bit). NOTE if your COM port is already set up you can remove lines 21-42.
#include <windows.h>
#include <stdio.h>
#include <conio.h>
int main(void) {
char port[] = "COM6", buffer[100];
int i;
DCB dcb;
HANDLE hCOM;
DWORD bytesRead;
@Lif3line
Lif3line / csv2cArrayDef.c
Created July 25, 2014 15:00
Short C program that takes in a runtime defined CSV file and outputs a 1D const array version as a single line. Useful for generating look up tables from CSVs essentially.
#include <stdio.h>
#include <stdlib.h>
int main() {
char c, inFileName[100], outFileName[100], type[20], arrayName[50];
FILE *fin, *fout;
int position;
printf("CSV to 1D lookup table suitable for use in C/C++ v0.1\n");
printf("Prints out to a file as a single line even if CSV is multiline\n\n");
@Lif3line
Lif3line / getSign.c
Created July 17, 2014 11:03
Get the sign of a number as {-1,1} in C/C++
x = 1;
signX = (x >= 0) - (0 > x);
@Lif3line
Lif3line / matrices.docx
Created June 26, 2014 12:04
Create an arbitrary sized correctly spaced matrix in the equation editor of Microsoft Word (tested on 2007+) 2x2 3x3 4x4
■(&@)
■(&&@@)
■(&&&@@@)
@Lif3line
Lif3line / gridmancer.js
Last active August 29, 2015 14:02
My solution to CodeCombat's Gridmancer Challenge. Attempts to draw the minimum number of rectangles onto the level (used for path finding and what not), manages to find the optimum number too <3
// Calculate positioning of rectangles by using a 2D array with a one-one mapping to the environmenet where a 1 indicates a
// potential mappable square and a 0 represents an unmappable square. Squares are 4mx4m
// Find rectangles by sweeping up then right to find the max possible rectangle for each section
// Adam Hartwell 2014, Idea shamelessly taken from post of the best algorithms for this challenge
var tileSize = 4;
var grid = this.getNavGrid().grid;
var gridArr = [];
var row, counter, x, y;
// Create an array with grid size 4m and each square being 1 to indicate free and 0 otherwise
@Lif3line
Lif3line / greed_human.js
Created June 15, 2014 00:14 — forked from schmatz/greed_human.js
Winning Greed tournament entry
// constants -------------------------------------------------------------------
var alliedTypes = {
peasant: 'peasant',
soldier: 'soldier',
knight: 'knight',
librarian: 'librarian',
griffinRider: 'griffin-rider',
captain: 'captain'
};
@Lif3line
Lif3line / mailer.php
Created May 28, 2014 11:00
Send an email from a server
<?php
$headers = 'From: ' . "\r\n";
$to = "";
$subject = "";
$body = "";
mail($to, $subject, $body, $headers);
?>
@Lif3line
Lif3line / popUp.php
Last active August 29, 2015 14:01
Pop up box for displaying messages over a page
<div id="overlay">
<div id="messageBox"></div>
</div>
<script type="text/javascript">
function popUp(message) {
document.getElementById("overlay").style.visibility = "visible";
}
function closePopUp() {