Skip to content

Instantly share code, notes, and snippets.

View bcawrse's full-sized avatar

Ben Cawrse bcawrse

View GitHub Profile
@bcawrse
bcawrse / install-choco-script.bat
Last active December 30, 2019 14:49 — forked from zaccb/install-choco-script.bat
Chocolatey install script
:: Install choco .exe and add choco to PATH
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
:: Install all the packages
:::: Browsers
choco install googlechrome -fy
choco install firefox -fy
:::: Text editors / IDEs
::choco install atom -fy
@bcawrse
bcawrse / .aliases
Last active May 24, 2023 19:48
Setup Zsh on fresh debian-based install
# General CLI utility.
alias la='ls -lAhF'
alias lar='ls -AhF'
alias ll='ls -lhF'
alias l='ls -hF'
alias cl='clear; lar'
alias c='clear;'
alias xg='xargs egrep -sin --color'
alias hostip="ip route get 0.0.0.0/0 | grep -Eo 'via \S+' | awk '{ print \$2 }'"
@bcawrse
bcawrse / .vimrc
Last active July 22, 2021 18:37
General .vimrc file
set tabstop=2
set shiftwidth=2
set textwidth=120
set expandtab
set number
set hlsearch
set pastetoggle=<F2>
:color delek
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
@bcawrse
bcawrse / tmux.conf
Last active October 29, 2021 16:54
tmux configuration file
## Use vi keys for scrolling etc.
set-window-option -g mode-keys vi
## Do not allow tmux to rename windows
set-option -g allow-rename off
## Extend how long pane #s are displayed
## Useful for `ctrl-b q` # to switch between panes
set -g display-panes-time 4000
@bcawrse
bcawrse / terminalFlatTheme.sh
Created August 17, 2019 21:02 — forked from anmoljagetia/terminalFlatTheme.sh
This gist shows how to setup terminal colors in the new gnome-terminal (v 3.14) and above. This was generated using a site called http://terminal.sexy
#!/usr/bin/env bash
# Base16 - Gnome Terminal color scheme install script
[[ -z "$PROFILE_NAME" ]] && PROFILE_NAME="terminal.flat.theme"
[[ -z "$PROFILE_SLUG" ]] && PROFILE_SLUG="terminal-flat-theme"
[[ -z "$DCONF" ]] && DCONF=dconf
[[ -z "$UUIDGEN" ]] && UUIDGEN=uuidgen
dset() {
local key="$1"; shift
# Set the editor to vim.. duh
git config --global core.editor vim
# Add aliases
git config --global alias.logthis 'log --decorate --date-order --graph --tags HEAD'
git config --global alias.logall 'log --decorate --date-order --remotes --graph --tags --branches'
git config --global alias.logalls 'log --decorate --date-order --remotes --graph --tags --branches --stat'
git config --global alias.diffc 'diff --cached'
git config --global alias.count 'count-objects -vH'
git config --global alias.package '"!f() { git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT $1..HEAD; }; f"'
@bcawrse
bcawrse / flatten.js
Last active August 21, 2019 21:40
Flatten example written in Node with jest tests
/**
* Flattens provided array.
*
* If an array is provided, this function will flatten it.
* EXAMPLE: flatten([[1, 2, [3]], 4]) returns [1, 2, 3, 4].
*
* @throws Throws an exception if provided parameter is not an Array.
* @param {Array} arr Array to flatten.
* @return {array} Flattend Array.
**/
function sendEmail() {
try {
var ss = SpreadsheetApp.getActive();
var ssID = ss.getId();
var date = Utilities.formatDate(new Date(), "GMT+5", "dd/MM/yyyy")
var subject = "Subject of Email : " + date;
var message = "Message in email body"
var sheet = DriveApp.getFileById(ssID);
var sentbyName = "Name shown for email sentby";
var email = Session.getEffectiveUser();
@bcawrse
bcawrse / Package-Restore.md
Last active September 6, 2019 21:20
Simple details for Update-Package -Reinstall within Visual Studio for NuGet on .Net 4

Using Update-Package -Reinstall for NuGet

Tired of having to look this up everytime I need it, so saving it in a gist. Original SO answer

Note you can force package restore to execute by running the following commands in the nuget package manager console

Update-Package -Reinstall

Forces re-installation of everything in the solution.

/****** Object: StoredProcedure [dbo].[usp_showIndexFragmentation] Script Date: 12/10/2019 3:15:50 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>