Skip to content

Instantly share code, notes, and snippets.

# File: /etc/bash.bashrc
# System-wide .bashrc file for interactive bash(1) shells.
# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.
# If not running interactively, don't do anything
if [[ -z "$PS1" ]]; then
@y2kdev
y2kdev / aliases
Created February 11, 2011 13:22
aliases for bash setup
# UTILS
alias tc='top -o cpu' # check cpu usage
alias tm='top -o vsize' # check memory usage
alias dud="du -d 1 -h" # disk usage
alias c="clear" # clear interface
alias dc="rm -rf" # remove folder with content in it
alias h="history" # review log of commands
alias tgzu="tar -xzvf" # uzip tar gzip file
alias dl="wget -N" # download file and overwrite if required
alias dlc="curl -O" # download file and overwrite if required
ls . # files in current directory
ls .. # files in parent directory
tree > log.txt # put the results of a command in a file (You must have tree installed. It's available via macports <sudo port install tree>)
ls >> log.txt # append the results of a command in a file
mkdir -p one/two/ # create multiple directories in one step
env # print out environment variables in name value pair
Control + a # go to the beginning line
Control + e # go to the end line
Control + k # delete all to the right
@pklaus
pklaus / clearRAM.sh
Last active September 9, 2024 17:09
A Script to Clear Cached RAM on Linux
#!/bin/bash
## Bash Script to clear cached memory on (Ubuntu/Debian) Linux
## By Philipp Klaus
## see <http://blog.philippklaus.de/2011/02/clear-cached-memory-on-ubuntu/>
if [ "$(whoami)" != "root" ]
then
echo "You have to run this script as Superuser!"
exit 1
fi
@pksunkara
pksunkara / config
Last active March 15, 2025 12:19
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
[user]
name = Pavan Kumar Sunkara
email = [email protected]
username = pksunkara
[init]
defaultBranch = master
[core]
editor = nvim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
@geoffreyanderson
geoffreyanderson / syncFilesystemToImage.sh
Created June 2, 2011 18:19 — forked from fairchild/bundle-to-ebs.sh
A script to rsync a running Linux OS to an image file (specifically, a 10GB image file for deployment to AWS EC2).
#!/bin/bash
# Run this script on a running Linux OS that you want to be put into an image file.
# Ensure that the system you run this on is less than 10GB in size if you wish to
# deploy the image file to AWS EC2.
# Note: This is based on Michael Fairchild's instance-to-ebs-ami.sh script.
# -https://gist.github.com/249915
imageFile=${1:-"awsImage-$(date +%m%d%y-%H%M).img"}
imageMountPoint=${2:-'/mnt/image'}
extraFilesArchive=${3:-'awsInstanceFiles.tar.gz'}
@shamansir
shamansir / lisp.lang.xml
Created August 23, 2011 07:34
Special highlighting files for gEdit: common lisp, processingJS, pegJS, pegC...
<?xml version="1.0" encoding="UTF-8"?>
<!--
Author: Ma Jiehong <[email protected]>
Copyright (C) 2010 Ma Jiehong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@alxrogan
alxrogan / auto_update.sh
Created October 4, 2011 15:10
ubuntu auto-update script to keep systems up to date on patches/etc
#!/bin/bash
# Script Name: auto_update.sh
# Original Author Name: Keith Bawden
# Modified by : Aaron
# Date: Wed May 17 15:40:32 JST 2006
# Updated: Thur Feb 01, 2007
# Description: This script will:
# Clean up the local apt repository of retrieved packages (apt-get clean)
# Resync the package index (apt-get update)
# If called with AUTOUPDATE set to yes then updates will be downloaded and