Skip to content

Instantly share code, notes, and snippets.

View th3terrorist's full-sized avatar

Roberto Montalti th3terrorist

View GitHub Profile
@th3terrorist
th3terrorist / rhighs.vim
Created July 30, 2022 11:28
Best vim colorscheme you'll ever see
highlight clear
let colors_name = "rhighs"
function s:highlight(group, bg, fg, style)
let gui = a:style == '' ? '' : 'gui=' . a:style
let fg = a:fg == '' ? '' : 'guifg=' . a:fg
let bg = a:bg == '' ? '' : 'guibg=' . a:bg
exec 'hi ' . a:group . ' ' . bg . ' ' . fg . ' ' . gui
endfunction
@th3terrorist
th3terrorist / vim-unreal.md
Last active July 30, 2022 11:33 — forked from chillpert/vim-unreal.md
Debugging and autocompletion for Unreal Engine 4 projects in (Neo)Vim

Debugging and autocompletion for Unreal Engine 4 projects in (Neo)Vim

Autocompletion

  1. Install coc.vim, e.g. with vim-plug inside .vimrc:
    Plug 'neoclide/coc.nvim'
  2. Run
    :CocInstall coc-clangd
  3. In UE4Editor
    • go to Edit - Editor Preferences - General - Source Code - Source Code Editor and select Visual Studio Code
    • go to File - Refresh Visual Studio Code Project
  4. Create a symlink from your project's root directory to myProject/.vscode/compileCommands_myProject.json
    ln -s .vscode/compileCommands_myProject.json compile_commands.json

Alternatively, you can also use YCM or Neovim's native LSP.

@th3terrorist
th3terrorist / rename-tag.sh
Created June 12, 2022 11:51
Rename a given tag with name `old` to `new`
#!/bin/bash
# $1 tag-name to rename
# $2 new tag name
git-tag-rename() {
git tag $2 $1
git tag -d $1
git push origin :refs/tags/${1}
git push --tags
}
@th3terrorist
th3terrorist / uegitignore
Created May 5, 2022 13:40
gitignore for unreal engine (simple stuff)
# Project ignore rules
ProceduralPrimitives.code-workspace
.vscode/
Content/StarterContent/
# Visual Studio 2015 user specific files
.vs/
# Compiled Object files
*.slo
@th3terrorist
th3terrorist / sm.cs
Last active January 22, 2022 13:59
File splitting and merging demo
using System;
using System.IO;
using System.Collections.Generic;
namespace Example
{
class Program
{
static void Main(string[] args)
{
@th3terrorist
th3terrorist / name_generator.js
Created January 20, 2022 19:16
Generate file names like a file manager
const generateNameInContext = (name, defaultName, namesContext) => {
if (!defaultName) {
defaultName = "Item";
}
if (!name) {
name = defaultName;
}
const fmtName = (number) => `${name}(${number})`;
@th3terrorist
th3terrorist / dijkstra.rs
Created November 15, 2021 22:08
A rust dijkstra implementation
use std::collections::VecDeque;
const INF: u32 = std::u32::MAX;
fn extract_min(graph: &Graph, queue: &mut Vec<u32>) -> u32 {
let mut min: u32 = INF;
let mut min_idx: usize = 0;
let _queue = queue.clone();
for (idx, node_id) in _queue.iter().enumerate() {
let n = graph.verts.iter().find(|&n| n.id == *node_id).unwrap();
@th3terrorist
th3terrorist / st.rs
Created November 15, 2021 22:07
Some file structures for ads implementations
#[derive(Eq, PartialEq, Clone, Copy)]
pub struct Branch {
pub x: u32,
pub y: u32,
pub w: u32
}
impl Branch {
pub fn new(x: u32, y: u32, w: u32) -> Self {
Self {
@th3terrorist
th3terrorist / prim_mst.rs
Last active November 14, 2021 10:27
A rust implementation of the Prim's mst algorithm.
use random::Source;
mod structures {
#[derive(Eq, PartialEq, Clone, Copy)]
pub struct Branch {
pub x: u32,
pub y: u32,
pub w: u32
}
@th3terrorist
th3terrorist / sh1ttyg4me.js
Last active September 23, 2021 07:57
A memory game on your terminal.
const fs = require("fs");
const memoryGame = () => {
class util {
static readNum() {
let buffer = Buffer.alloc(4);
buffer.fill(0);
fs.readSync(0 /*stdin*/, buffer, 0, 4);
return buffer[0] % 48; //( ͡° ͜ʖ ͡°)
}