Skip to content

Instantly share code, notes, and snippets.


Noah Overcash ncovercash

View GitHub Profile

Getting Started with Valgrind

The testing server now comes with the utility Valgrind preinstalled.

Valgrind is a utility which is able to detect memory leaks and provide information about memory-related errors (segmentation faults).

Valgrind supports a small set of linux-based operating systems and, where it is installable, it is infamously difficult to install. Therefore, the server's version is extremely helpful for testing.

This guide will show how to use Valgrind on the cs-intro server.

ncovercash / tester.cpp
Created Sep 25, 2020
CS 201 P1 Test File
View tester.cpp
#include <iostream>
#include <unordered_map>
#include <vector>
#include "CDA.cpp"
using namespace std;
bool nameExists(vector<string> list, string name) {
for (int i = 0; i < list.size(); i++) {
View snippet.php
case "ADDSKU":
$skus = $dbh->query("SELECT * FROM `".DB_SKU_NAME_TABLE."`;")->fetchAll();
$skuAssocArray = [];
foreach ($skus as $sku) {
$skuAssocArray[$sku["SKU"]] = $sku["NAME"];
ncovercash / buildMultipartFormData.php
Created Sep 22, 2017 — forked from ssigwart/buildMultipartFormData.php
Build multipart/form-data in PHP
View buildMultipartFormData.php
* Build multipart/form-data
* @param array @$data Data
* @param array @$files 1-D array of files where key is field name and value if file contents
* @param string &$contentType Retun variable for content type
* @return string Encoded data
View gist:1c8243d5adb91753d7822b64aff06969
String[] buttonTexts = new String[] {"m+", "m-", "mc", "mr", "ms", "CE/C", "¹⁄ᵪ", "x²", "√", "⁺⁄₋", "rand", "AC", "floor", "ceil", "++", "--", "round", "eᵡ", "sin", "cos", "tan", "", "DEG", "SCI", "sin⁻¹", "cos⁻¹", "tan⁻¹", "e", "10ᵡ", "÷", "log", "ln", "(", ")", "", "✕", "^", "π", "7", "8", "9", "–", "x³", "∛", "4", "5", "6", "+", "abs", "%", "1", "2", "3", "=", "OFF", "isint", "0", ".", "(−)"};
public static String expandNumToDigits(int in, int digits) {
String stringIn = ""+in;
while (stringIn.length() < digits) {
stringIn = "0"+stringIn;
return stringIn;
View incremental_rand_sort.php
class CardDeck {
public $deck = Array();
public function __construct(int $size) {
for ($i=1; $i <= $size; $i++) {
$this->deck[] = Array($i);
View suggestions.txt
100_doors - intermediate challenge, requires multiple loops and a boolean array
guess_user_number - binary search, computer guesses number, user says higher/lower
even_fibonacci - find a sum of the even numbers in the first x numbers in the fibonacci sequence
palindromes - there are several in GH, ex largest_palindrome_product, however string palindromes are better
you could make it indifferent to cases, spaces, etc
number_letter_counts - thing about getting the number of letters in a spelled out number (one, two etc)
number_spiral - hard. extra credit if you give it. generating a spiral of numbers in a 2d array
View gist:6b1a80edfe37c4c9fbbe88ed2e73d25b
Human fills spot 2
0 returns a score of -10
1 returns a score of 0
3 returns a score of -10
4 returns a score of 0
5 returns a score of -10
6 returns a score of 0
7 returns a score of -10
8 returns a score of -10
ncovercash /
Last active Dec 23, 2016
Why photos taken on a modern device may appear incorrectly rotated:

Why photos taken on a modern device may appear rotated incorrectly:

Originally written as an explainiation for my Precalculus teacher as to why student's work render incorrectly in Google Classroom.

Image metadata (EXIF)

Exchangeable image file format (officially Exif, according to JEIDA/JEITA/CIPA specifications) is a standard which allows for metadata to be stored in an image or audio file. This is important, as it can store information about the image besides the image itself. Common applications include things such as date taken, shutter speed, camera type, or location, however any aribtrary key and value may be stored. A few keys are required, such as the use of the Discrete Cosine Transformation (DCT) on image/jpeg files, various algorithms and codecs used for processing RIFF files such as audio/wav A photo taken on a modern device, such as an iPhone or similar, can contain dozens if not hundreds of these tags, however those found in most images are things such as bit depth, colour palette,