Skip to content

Instantly share code, notes, and snippets.

@NatWeiss
NatWeiss / linux514-xrealloc.patch
Created June 1, 2023 22:45
linux514-xrealloc.patch
diff --git a/tools/lib/subcmd/subcmd-util.h b/tools/lib/subcmd/subcmd-util.h
index 794a375dad36..7009fc176636 100644
--- a/tools/lib/subcmd/subcmd-util.h
+++ b/tools/lib/subcmd/subcmd-util.h
@@ -49,13 +49,12 @@ static NORETURN inline void die(const char *err, ...)
static inline void *xrealloc(void *ptr, size_t size)
{
- void *ret = realloc(ptr, size);
- if (!ret && !size)
@NatWeiss
NatWeiss / my_vim.fish
Created August 12, 2022 17:28
Fish vim function
function my_vim
if test $argv[2..-1]
nvim $argv[2..-1]
else if jobs
#echo 'has jobs'
fg
else
#echo 'no jobs'
nvim
end
@NatWeiss
NatWeiss / config.fish
Last active August 12, 2022 23:46
Fish config
# settings
set fish_greeting
set HOME ~
set EDITOR nvim
set HISTSIZE 'INFINITE'
set HISTFILESIZE 'INFINITE'
# load aliases
alias v="my_vim"
alias w="cd /Wraithbinder && clear && cat .art"
@NatWeiss
NatWeiss / init.vim
Last active August 12, 2022 17:16
Nvim init.vim
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
let g:python3_host_prog = '/usr/bin/python3'
source ~/.vimrc
@NatWeiss
NatWeiss / fish_prompt.fish
Last active August 12, 2022 22:08
Fish prompt
function fish_prompt
set dir (pwd)
set dir (string replace '/Users/nat' '~' $dir)
set dir (string replace '/home/nat' '~' $dir)
set host (hostname 2> /dev/null)
set git_branch (git branch 2> /dev/null | sed -e '/^[^\*]/d' -e 's/* (.*)/(1)/')
set git_status (git status -s 2> /dev/null | wc -l | xargs)
set_color 1F1
echo -n $host':'$dir
@NatWeiss
NatWeiss / .bash_aliases
Last active July 17, 2019 03:07
Bash aliases
alias off="(sleep 1 && sudo shutdown now &) && exit"
v() {
if [[ ! -z $(jobs) ]]; then
#echo 'has jobs'
fg
else
#echo 'no jobs'
command vim "$@"
fi
@NatWeiss
NatWeiss / xcode-dark.vim
Last active November 3, 2017 18:25
Vim color theme that looks like Xcode's default but with a dark background
" Vim color file
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "Xcode Dark"
#message(STATUS "SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
#message(STATUS "COMPILER: ${CMAKE_CXX_COMPILER_ID}")
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if(WINRT)
set(SYSTEM_STRING "Windows RT")
elseif(WP8)
set(SYSTEM_STRING "Windows Phone 8")
else()
cmake_policy(SET CMP0017 NEW)
cmake_minimum_required(VERSION 2.8)
if (POLICY CMP0058)
# Ninja requires custom command byproducts to be explicit
cmake_policy(SET CMP0058 NEW)
endif()
#
# First set project name so cmake variables get set
@NatWeiss
NatWeiss / makefile
Last active December 23, 2019 17:26
Linux setup makefile
user:
# setup .inputrc for faster tab completion
echo "set completion-ignore-case on" > ~/.inputrc
# create aliases
rm -f .bash_aliases
wget https://gist.githubusercontent.com/NatWeiss/ed2129061935fea0ee004cd360c0b708/raw/.bash_aliases
# update packages
sudo apt-get update --allow-releaseinfo-change
sudo apt-get dist-upgrade --fix-missing
sudo apt-get autoremove