Skip to content

Instantly share code, notes, and snippets.

View YourFriendCaspian's full-sized avatar
🙃
I'm sure I'll be slow to respond so don't be mad.

yourfriendcaspian YourFriendCaspian

🙃
I'm sure I'll be slow to respond so don't be mad.
View GitHub Profile
@YourFriendCaspian
YourFriendCaspian / add_read_only_pg_user.rb
Last active September 2, 2017 03:27 — forked from blasterpal/add_read_only_pg_user.rb
Add read only user to PG 9 on DB, cookbook snippet.
# Create a user with Login
sql = [%(CREATE ROLE <username> WITH PASSWORD '<password>' LOGIN)]
# # Allow to connect
sql << %(GRANT CONNECT ON DATABASE reports TO <username>)
# # Allow to use schema
sql << %(GRANT USAGE ON SCHEMA public TO <username>)
# # grant on current objects
sql << %(GRANT SELECT ON ALL TABLES IN SCHEMA public TO <username>)
# # grant on future objects
sql << %(ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO <username>)
@YourFriendCaspian
YourFriendCaspian / thinkpad-acpi.txt
Created August 20, 2017 09:36
ThinkPad ACPI Extras Driver
ThinkPad ACPI Extras Driver
Version 0.25
October 16th, 2013
Borislav Deianov <[email protected]>
Henrique de Moraes Holschuh <[email protected]>
http://ibm-acpi.sf.net/
@YourFriendCaspian
YourFriendCaspian / laptop-mode
Created August 20, 2017 09:32
Conserve battery power using laptop-mode
How to conserve battery power using laptop-mode
-----------------------------------------------
Document Author: Bart Samwel ([email protected])
Date created: January 2, 2004
Last modified: December 06, 2004
Introduction
------------
@YourFriendCaspian
YourFriendCaspian / asus-laptop.txt
Created August 20, 2017 09:26
Asus Laptop Extras
Asus Laptop Extras
Version 0.1
August 6, 2009
Corentin Chary <[email protected]>
http://acpi4asus.sf.net/
This driver provides support for extra features of ACPI-compatible ASUS laptops.
It may also support some MEDION, JVC or VICTOR laptops (such as MEDION 9675 or
@YourFriendCaspian
YourFriendCaspian / diskbench
Created August 18, 2017 10:03
Command Line Disk Benchmark
#!/bin/sh
# This came from Greg V's dotfiles:
# https://github.com/myfreeweb/dotfiles
# Feel free to steal it, but attribution is nice
#
# Thanks:
# http://www.amsys.co.uk/2013/blog/using-command-line-to-benchmark-disks/
echo "Benchmarking write..."
dd if=/dev/zero bs=2048k of=tstfile count=1024 2>&1 | grep sec | awk '{print $1 / 1024 / 1024 / $5, "MB/sec" }'
@YourFriendCaspian
YourFriendCaspian / path
Created August 18, 2017 10:01
Show PATH?
#!/usr/bin/env zsh
# This came from Greg V's dotfiles:
# https://github.com/myfreeweb/dotfiles
# Feel free to steal it, but attribution is nice
autoload colors && colors
echo $PATH | tr ":" "\n" | \
awk "{ sub(\"/usr\", \"$fg_no_bold[green]/usr$reset_color\"); \
sub(\"/bin\", \"$fg_bold[blue]/bin$reset_color\"); \
@YourFriendCaspian
YourFriendCaspian / solarized_bash_prompt.bash
Created July 28, 2017 06:06
Shell prompt based on the Solarized Dark theme
# Shell prompt based on the Solarized Dark theme.
# Screenshot: http://i.imgur.com/EkEtphC.png
# Heavily inspired by @necolas’s prompt: https://github.com/necolas/dotfiles
# iTerm → Profiles → Text → use 13pt Monaco with 1.1 vertical spacing.
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM='gnome-256color';
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM='xterm-256color';
fi;
@YourFriendCaspian
YourFriendCaspian / new_script
Created July 28, 2017 05:07
Bash shell script template generator
#!/bin/bash
# ---------------------------------------------------------------------------
# new_script - Bash shell script template generator
# Copyright 2012, William Shotts <[email protected]>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@YourFriendCaspian
YourFriendCaspian / _msfconsole
Created July 11, 2017 06:44 — forked from zeroSteiner/_msfconsole
ZSH completions for Metasploit Utilities
#compdef msfconsole
# ------------------------------------------------------------------------------
# Copyright (c) 2014 Spencer McIntyre
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# setup metasploit from master on github: https://github.com/rapid7/metasploit-framework/wiki/Setting-Up-a-Metasploit-Development-Environment
# good help on console and metasploit: http://www.offensive-security.com/metasploit-unleashed/Msfconsole
#start msfconsole
use auxiliary/scanner/http/apache_mod_cgi_bash_env
set VHOST app.local
set TARGETURI "/all"
set RPORT 3000