Skip to content

Instantly share code, notes, and snippets.

@8dcc
8dcc / hsvrgb.cpp
Last active June 4, 2022 18:42 — forked from fairlight1337/hsvrgb-cpp
Simple RGB/HSV conversion in C++
// Copyright (c) 2014, Jan Winkler <winkler@cs.uni-bremen.de>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
@8dcc
8dcc / get-links.js
Created May 17, 2022 10:52
Get all the hrefs from a page's links.
@8dcc
8dcc / clone-important.sh
Last active April 23, 2022 16:13
Bash script for cloning my most important repos (a lot). Mostly for local backups.
#!/bin/bash
repos=(
"vat"
"v-stuff"
"browser-homepage"
"discord-bot"
"vim-dotfiles"
"dotfiles"
"langtons-ant-c"
@8dcc
8dcc / userscript-function-delay.js
Created April 17, 2022 02:41
Add custom delay to userscript functions.
// ==UserScript==
// @name Delay function
// @namespace Violentmonkey Scripts
// @include *://example.com/*
// @run-at document-start
// @author Null (r4v10l1)
// ==/UserScript==
// --------------------- Settings ---------------------
var MY_DELAY = 500; // ms, delayChecker will wait this
@8dcc
8dcc / remove-video-suggestions.js
Last active April 17, 2022 02:28
Userscript for removing the suggestions on youtube. Useful if you use youtube on a vertical monitor.
// ==UserScript==
// @name Remove suggestions YouTube
// @namespace Violentmonkey Scripts
// @include *://*.youtube.com/*
// @grant GM_addStyle
// @run-at document-idle
// @author Null (r4v10l1)
// ==/UserScript==
GM_addStyle (`
@8dcc
8dcc / single-pull.md
Created April 6, 2022 23:59
Single pull a file with git.
git fetch --all
git checkout origin/master -- <your_file_path>
git add <your_file_path>
git commit
#git commit -m "<your_file_name> updated"
@8dcc
8dcc / rsync-windows.sh
Last active April 12, 2022 18:48
Using rsync in windows (External drive)
# Will backup the 'D:/Stuff' folder to 'E:/Stuff' (Will create the folder if does not exist)
rsync -av /cygdrive/d/Stuff /cygdrive/e
# Will ignore exising files
rsync -av --ignore-existing /cygdrive/d/Stuff /cygdrive/e
# Will delete files that no longer exist in 'D:/Stuff'
rsync -av --delete /cygdrive/d/Stuff /cygdrive/e
@8dcc
8dcc / docker-cheatsheet.sh
Last active August 26, 2022 17:09
Docker cheatsheet
# Build image
docker build -d image_name .
# Run image in daemon and remove after exit
docker run --name container_name --rm -it -d image_name
# Clear images without tag
docker rmi $(docker images -f "dangling=true" -q)
# Clone an image's tag
@8dcc
8dcc / 2d-arrays.c
Created March 17, 2022 17:00
Simple way to pass 2d arrays to a C function.
#include <stdio.h>
#define ARRAY_SIZE 10
int test(int* array, int ys, int xs) {
int desiredx = 5;
int desiredy = 3;
array[desiredy * xs + desiredx] = 1;
array[desiredy * ys + desiredx] = 2;
@8dcc
8dcc / compile.sh
Last active January 18, 2022 15:00
#!/bin/sh
##############################
# For linux only. Usage:
# ./compile.sh FILE.c [run]
##############################
# Check if sdl2 is installed
if [[ $(command -v sdl2-config) == "" ]]; then
echo "Cant' find sdl2. Exiting..."