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 / mousefix.txt
Created October 19, 2019 05:23
xinput mouse fix
xinput --set-prop "Razer Razer DeathAdder" "libinput Accel Speed" -0.95
xinput --set-prop "Razer Razer DeathAdder" "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
xinput --set-prop "Razer Razer DeathAdder" "libinput Accel Profile Enabled" 0, 1
@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 / linux_screens.md
Last active January 11, 2020 07:39
linux screens

Create a screen

screen -S server

Kill a screen

screen -XS foo quit

Reattach to a screen

screen -R foo

List screens

@RolandWarburton
RolandWarburton / navigating_Zsh_and_Bash.md
Last active April 29, 2023 16:31
navigating Zsh and Bash cheat sheet!

Start and end of line

  1. Ctrl+A or Home: Go to the beginning of the line.
  2. Ctrl+E or End: Go to the end of the line. Zsh Bindings:
    bindkey "^[[H" beginning-of-line
    bindkey "^[[F" end-of-line

Start and end of line

  1. Alt+F: Go right (forward) one word.
  2. Alt+B: Go left (back) one word.