Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile
#!/usr/bin/env bash
# kill previous yum operations
if [[ $(pgrep yum) != '' ]]; then
pgrep yum | xargs sudo kill -9
rm -f /var/run/yum.pid
rm -rf /var/tmp/*
rm -rf /var/cache/yum/*
rpm --rebuilddb
yum clean --noplugins all
@pythoninthegrass
pythoninthegrass / upgrade_vim.sh
Last active January 8, 2021 20:47 — forked from yevrah/Upgrade vim
Update to Vim8 on Centos 7
# SOURCE: @zhouyanlt https://gist.github.com/yevrah/21cdccc1dc65efd2a4712781815159fb#gistcomment-2695800
sudo yum install -y gcc git ncurses-devel
git clone https://github.com/vim/vim.git ~/vim
cd ~/vim/src
make distclean # if you built Vim before
make -j8
sudo make install
cp -ru ~/vim/src/vim /usr/bin # overwrites /usr/bin/vim w/o confirmation
@pythoninthegrass
pythoninthegrass / click.oscript
Last active January 23, 2019 23:27 — forked from wkoszek/click.oscript
Clicking "Allow" button in System Preferences via Screen Sharing
# This is clicking "Allow" in System Preferences "Security & Privacy" screen
# when you're on Screen Sharing. Otherwise it doesn't work.
# To fix:
# - Put "Security & Privacy" window in the top left screen
# - open a Terminal on a side
# - save click.oscript
# - Run: osascript click.oscript
#
# The mouse click you send should hit "Allow" button. You may need to move the window a little bit.
# Script originally from: https://discussions.apple.com/thread/3708948
@pythoninthegrass
pythoninthegrass / custom-juno.sh
Last active May 11, 2019 14:09 — forked from konstantinbo/custom-juno.sh
Thing to do after installation of Elementary OS Juno (5.0)
#!/usr/bin/env bash
# SOURCE: https://gist.github.com/konstantinbo/d21dfa5c7a0edbaec8244f97eb177209
# Uninstall unnecessary programs
# sudo apt-get purge epiphany-browser epiphany-browser-data #browser
# sudo apt-get purge pantheon-mail
# Update your system (clear apt cache/locks first)
@pythoninthegrass
pythoninthegrass / ldap_auth.py
Last active May 14, 2019 19:43 — forked from femmerling/authenticate.py
I have to create user authentication using python-ldap. After googling around and trying out stuffs, this is the final code for you to use. Please remember to adjust the user_dn, and base_dn accordingly to the format used in your LDAP server.
# to be able to import ldap run pip install python-ldap
import ldap
if __name__ == "__main__":
ldap_server="x.x.x.x"
username = "someuser"
password= "somepassword"
# the following is the user_dn format provided by the ldap server
user_dn = "uid="+username+",ou=someou,dc=somedc,dc=local"
<#
.SYNOPSIS
This script will install Windows Server Update Services (WSUS) in your lab
.NOTES
You need a Windows Server 2012 R2 for this script to work.
This script is part of a series to automate your lab on www.dominikbritz.com
#>
#Requires -Version 3
@pythoninthegrass
pythoninthegrass / README.md
Last active May 22, 2020 16:01 — forked from tombigel/README.md
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

Mac OS X

To check the current limits on your Mac OS X system, run:

@pythoninthegrass
pythoninthegrass / centos_pi.sh
Last active September 4, 2019 20:13
Bootstrap most of the Raspberry Pi CentOS setup. Add to SD card after flashing OS, then SSH into box (sshd enabled by default.)
#!/usr/bin/env bash
# TODO:
# vars (e.g., su $loggedInUser -c 'commands')
# ansible: change root password, create non-root user, bash > yaml conversion
# find headless raspberry pi
# sudo nmap -sS -p 22 192.168.8.0/24 | grep -B5 'Raspberry Pi Foundation' | awk '/192.168.8/ {print $5}'
# enable ssh
@pythoninthegrass
pythoninthegrass / profile.ps1
Created September 6, 2019 14:17
PowerShell profile via cmder (emacs readline needed for BASH keybindings.)
# Init Script for PowerShell
# Created as part of cmder project
# !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
# !!! Use "%CMDER_ROOT%\config\user_profile.ps1" to add your own startup commands
# Compatibility with PS major versions <= 2
if(!$PSScriptRoot) {
$PSScriptRoot = Split-Path $Script:MyInvocation.MyCommand.Path
}
@pythoninthegrass
pythoninthegrass / jenkins-docker-compose.yml
Last active November 29, 2026 12:15 — forked from SWBSanjeewa/jenkins-docker-compose
Run jenkins master and slave using docker compose
# MASTER PRE-REQS
# Install docker, docker-compose
# mkdir -p ~/{jenkins,jnlp_slave}
# master
# docker run -d \
# -u root \
# --name=jenkins \
# -e TZ=America/Denver \