Skip to content

Instantly share code, notes, and snippets.

View games647's full-sized avatar

games647 games647

View GitHub Profile
@games647
games647 / .cflags
Created December 31, 2017 16:53
Enhanced gcc (c/c++) compiler flags for enhanced linux security and performance
#-- Compiler and Linker Flags
# -march (or -mcpu) builds exclusively for an architecture
# -mtune optimizes for an architecture, but builds for whole processor family
export CFLAGS="-pipe -mtune=generic -fstack-protector-all -O3 -fno-plt"
export CXXFLAGS="-pipe -mtune=generic -fstack-protector-all -O3 -fno-plt"
export CPPFLAGS="-D_FORTIFY_SOURCE=2"
export LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
@games647
games647 / Makefile
Last active October 25, 2017 15:17
Simple Makefile for build bluespec projects. It will compile and link it by default. You could run `make compile link sim` to test it at the same moment.
TOPFILE = Testbench.bsv
TOPMODULE = mkTestbench
BUILD_PATH = build
BSIM_EXE = $(BUILD_PATH)/outputFile
BSCFLAGS = -u
BUILD_DIR_FLAGS = -simdir $(BUILD_PATH) -bdir $(BUILD_PATH) -info-dir $(BUILD_PATH)
default: compile link
@games647
games647 / .bashrc
Created October 21, 2017 14:15
Colored man pages using less. This code snippet affects other parts of your like the normal less command. Source: https://unix.stackexchange.com/questions/119/colors-in-man-pages
[[ -f ~/.less-colors ]] && . ~/.less-colors
@games647
games647 / config
Last active November 22, 2017 14:07
SSH config for enhanced encryption and security settings.
HOST *
# Force SSH2
Protocol 2
# Use this only if supported
#VerifyHostKeyDNS yes
# We will only use ed25519 keys
RSAAuthentication no
@games647
games647 / btrfs-size.sh
Created July 16, 2017 15:38
Invoke this script to get the size of your subvolumes and snapshots
#!/bin/bash
#Author Kyle Agronick <agronick@gmail.com>
#Usage: Invoke this script to get the size of your subvolumes and snapshots
#Make sure to run "sudo btrfs quota enable /" first
LOCATION='/'
if [ $1 ]; then
LOCATION=$1
fi
@games647
games647 / .gitconfig
Created July 16, 2017 15:36
Git configuration
[user]
name = games647
email = games647@users.noreply.github.com
signingkey = BFC68C8708713A88
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
[core]
whitespace = warn
@games647
games647 / .conkyrc
Created July 16, 2017 15:20
Conky config
own_window yes
own_window_class Conky
own_window_type dock
own_window_hints sticky,undecorated,skip_pager,skip_taskbar,above
own_window_transparent no
#own_window_argb_visual yes
own_window_colour 2f2f2f
#own_window_argb_value 200
double_buffer yes
@games647
games647 / move-to-next-monitor
Created June 5, 2017 07:12
Move the current open window to the next monitor. Requires xdotool wmctrl xwininfo Source: https://makandracards.com/makandra/12447-how-to-move-a-window-to-the-next-monitor-on-xfce-xubuntu
#!/bin/sh
#
# Move the current window to the next monitor.
#
# Only works on a horizontal monitor setup.
# Also works only on one X screen (which is the most common case).
#
# Props to
# http://icyrock.com/blog/2012/05/xubuntu-moving-windows-between-monitors/
#
trap 'echo -e "\e]0;$BASH_COMMAND\007"' DEBUG
@games647
games647 / push-down.pl
Created January 29, 2017 10:25
A push-down automaton written in Prolog
uprg(P):- uprg(P, [#]). % Creates a new push-down automaton
%Input | head of the stack :- Stackoutput
uprg([p|Tail], Stack):- uprg(Tail, [p|Stack]).
uprg([p|Tail], [#|Stack]):- uprg(Tail, [p, #|Stack]).
uprg([p|Tail], [a|Stack]):- uprg(Tail, [p, a|Stack]).
uprg([a|Tail], [p|Stack]):- uprg(Tail, [a|Stack]).
uprg([a|Tail], [a|Stack]):- uprg(Tail, [a|Stack]).
uprg([b|Tail], [a|Stack]):- uprg(Tail, [b|Stack]).