Skip to content

Instantly share code, notes, and snippets.

@Trucido
Trucido / linux_os_detection_from_facter.include.spec
Last active June 28, 2018 14:07
rpm spec macros to do linux detection
%ifos Linux
%define is_suse_family %((test -e /etc/SUSE-brand || test -e /etc/SuSE-release) && echo 1 || echo 0)
%define is_sle_family %(grep -qi 'SUSE LINUX Enterprise' /etc/SuSE-release && echo 1 || echo 0)
%define is_sles %(grep -qi 'SUSE LINUX Enterprise Server' /etc/SuSE-release && echo 1 || echo 0)
%define is_sled %(grep -qi 'SUSE LINUX Enterprise Desktop' /etc/SuSE-release && echo 1 || echo 0)
%define is_opensuse %((grep -qi 'openSUSE' /etc/SUSE-brand || grep -qi 'openSuSE' /etc/SuSE-release) && echo 1 || echo 0)
%define is_redhat_family %(test -e /etc/redhat-release && echo 1 || echo 0)
# refer to http://fedoraproject.org/wiki/Packaging:DistTag
%define is_rhel %(grep -qi 'Red Hat Enterprise Linux Server' /etc/redhat-release && echo 1 || echo 0)
#!/bin/sh
# -*- mode:shell-script sh-basic-offset:4 indent-tabs-mode:nil -*-
########################################################################################################################
# zswap.sh - Activate and tune Zswap compressed cache for swap pages.
#
# Enables/Renables/tunes zswap without the need for initramfs/dracut/modprobe/modules-load hackery.
#
# Author : <REDACTED>
# Copyright: 2018 <REDACTED> <########@####.com>
#
#!/bin/sh
# -*- mode:shell-script sh-basic-offset:4 indent-tabs-mode:nil -*-
########################################################################################################################
# zswap.sh - Activate and tune Zswap compressed cache for swap pages.
#
# Enables/Renables/tunes zswap without the need for initramfs/dracut/modprobe/modules-load hackery.
#
# Author : <REDACTED>
# Copyright: 2018 <REDACTED> <########@####.com>
#
#!/bin/bash
#
# /etc/init.d/zswap || zswap.service || /usr/local/sbin/zswap || somethingsomething
#
# License: copyleft, copyup, copydown, copyright, do whatever the fuck you want.
### BEGIN INIT INFO
# Provides: zswap
# Required-Start:
# Required-Stop:
# .bash_prompt
BASE0=$'\E[38;5;244m'
BASE00=$'\E[38;5;241m'
BASE01=$'\E[38;5;240m'
BASE02=$'\E[38;5;235m'
BASE03=$'\E[38;5;234m'
BASE1=$'\E[38;5;245m'
BASE2=$'\E[38;5;254m'
BASE3=$'\E[38;5;230m'
--- 1/etc/profile.d/vte.sh 2018-04-19 16:46:08.000000000 -0400
+++ 2/etc/profile.d/vte.sh 2018-05-17 15:08:01.808845123 -0400
@@ -50,9 +50,11 @@
}
__vte_prompt_command() {
+ local command=$(HISTTIMEFORMAT= history 1 | sed 's/^ *[0-9]\+ *//')
+ command="${command//;/ }"
local pwd='~'
[ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/}
--- 1/usr/share/vim/site/plugin/powerline.vim 2018-05-19 13:09:49.950986016 -0400
+++ 2/usr/share/vim/site/plugin/powerline.vim 2018-05-19 13:10:13.602985689 -0400
@@ -26,14 +26,14 @@ if exists('g:powerline_pycmd')
let s:pyeval = g:powerline_pyeval
let s:has_python = 1
endif
-elseif has('python')
- let s:has_python = 1
- let s:pycmd = 'py'
- let s:pyeval = get(g:, 'powerline_pyeval', 'pyeval')
# .bashrc -*- mode:shell-script sh-basic-offset:4 indent-tabs-mode:nil -*-
#
#
# Sanity checks
#
[ -n "$BASH_VERSION" -a -n "$BASH" ] || return 0
# Always set histfile to avoid clobbering other shells.
HISTFILE=${HOME}/.bash_history
# Test for corner cases in shells sourcing this file.
################################################################################
## ~/.inputrc
##
## Control the behaviour of the readline library used e.g.
## by the bash in the interactive mode for line editing.
##
################################################################################
##----------------------------------------------------------------------------##
## readline(3) - Global order: /etc/inputrc, ${INPUTRC:-$HOME/.inputrc}
@Trucido
Trucido / uniquefy.sh
Created April 8, 2018 20:50
uniquefy_buttpaths
uniquefy_search_path ()
{
OIFS="$IFS"
IFS='
'
set -- $(echo ${1+"$@"} | sed -r 's@/*:|([^\\]):@\1\n@g;H;x;s@/\n@\n@')
IFS="$OIFS"
_y=""
for _x ; do