Skip to content

Instantly share code, notes, and snippets.

View RolandWarburton's full-sized avatar
🍃

Roland RolandWarburton

🍃
View GitHub Profile
// arrcontainer cc = arrcontainer(20);
int* ip = (int* )realloc(cc, sizeof(int)*10);
// int* ip = (int* )calloc(8, 1000);
ip[1] = 10;
cout << *ip;
int *arr = new int[10];
int *ptr = arr;
int *ptr_new;
ptr_new = (int *)realloc(ptr, sizeof(int)*3);
ptr_new = (int *)realloc(ptr, sizeof(int)*3);
@RolandWarburton
RolandWarburton / realloc2.cpp
Created September 28, 2019 02:29
realloc arrays 2. electric boogaloo
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
int *cc = new int[20];
int size = 0;
for (size_t i = 0; i < 5; i++)
@RolandWarburton
RolandWarburton / readint.cpp
Last active October 1, 2019 11:47
read int validator
int readInt(string output = "")
{
cout << output;
int input = 0;
bool valid = false;
// while the input isnt correct. keep asking
// istream (cin) will flag itself if there was an issue reading
// eg. a char was entered
while (!valid)
{
@RolandWarburton
RolandWarburton / regrange.py
Created October 19, 2019 05:26
regex range
from range_regex import bounded_regex_for_range
a = input('Enter your input:')
b = input('Enter your input:')
print(bounded_regex_for_range(int(a), int(b)))
// fix launch.json by adding this.
// make sure to change the gcc version, currently on 9.2.0
// check with: ``c++ --version``
// reference
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
@RolandWarburton
RolandWarburton / merge_RepoB->RepoA
Created November 22, 2019 01:51
Merge 2 repos together and preserve that sweet sweet commit history
# Beware this will not create a subfolder for RepoB in RepoA
If you want to merge project-b into project-a:
cd path/to/project-a
git remote add project-a path/to/project-b
git fetch project-b --tags
git merge --allow-unrelated-histories project-b/master
git remote remove project-b
@RolandWarburton
RolandWarburton / MediumDotComDark.css
Last active December 6, 2019 02:19
medium dark theme for stylus
/* General styling */
html, body, div, p, section, article
{
background-color: #222 !important;
color: #aaa !important;
}
h1, h2, h3, h4, h5, h6, a {
color: #eee !important;
}
@RolandWarburton
RolandWarburton / forbesAdBlockerAndDarkTheme.user.css
Last active December 6, 2019 04:22
forbes.com ad blocker to block forbes anti ad block, oh my (also dark theme)
/* ==UserStyle==
@name forbes ad blocker blocker
@namespace github.com/openstyles/stylus
@version 1.0.0
@description block the modal popup and unfreeze the page
@author Roland Egerton-Warburton
==/UserStyle== */
@-moz-document domain("forbes.com") {
/* Block the ad blocker*/
@RolandWarburton
RolandWarburton / urls
Last active December 8, 2019 09:37
bunch of urls
npm
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -