Skip to content

Instantly share code, notes, and snippets.

View samrocketman's full-sized avatar

Sam Gleske samrocketman

View GitHub Profile
@samrocketman
samrocketman / update_dns_adblock_filters
Created October 4, 2013 04:00
Generate a poisoned configuration file which bind can eat for blocking domain names. The file the script eats contains one domain per line.
#!/bin/bash
#Created by Sam Gleske
#Thu Jun 7 20:43:09 EDT 2012
adblockfile="dns_ad_block_list.txt"
adblocklistdir="/media/backup/Operating Systems - Linux/Fedora/16/configs"
adblocklist="${adblocklistdir}/${adblockfile}"
backup_dir="/media/backup/Operating Systems - Linux/Fedora/16/configs/etc/named"
outfile="/etc/named/named.conf.ads.block"
echo "Creating a unique domain list."
@samrocketman
samrocketman / GitLab_projects_function.py
Last active December 25, 2015 07:09
This shows what pyapi-gitlab would be like without pagination on by default.
#snippet taken from pyapi-gitlab @ 2df11db8714a4657020a994ad940bd82858ca39b
#https://github.com/Itxaka/pyapi-gitlab/blob/2df11db8714a4657020a994ad940bd82858ca39b/gitlab/__init__.py#L287-L304
def getprojects(self, page=None, per_page=None, sudo=""):
"""
Returns a dictionary of all the projects
:param page: Which page to return (default is None which returns all)
:param per_page: Number of items to return per page (default is None which returns all)
:return: list with the repo name, description, last activity,
web url, ssh url, owner and if its public
@samrocketman
samrocketman / gist:7090089
Created October 21, 2013 20:08
gitconfig tree alias
[alias]
tree = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white). %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative
tree2 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white). %an%C(reset)' --abbrev-commit
@samrocketman
samrocketman / gist:7198552
Created October 28, 2013 15:13
configuring omniauth quick example
#add this to my ~git/gitlab/conf/initializers/devise.rb just before the last "end"
config.omniauth :cas, host: 'serverhost', port: '443', ssl: 'true', login_url: '/cas/login', logout_url: '/cas/confirmLogout', uid_key: 'uid', disable_ssl_verification: false, ssl: true
#In gitlab.yml
omniauth:
providers:
- { name: 'cas' }
@samrocketman
samrocketman / gist:7218569
Created October 29, 2013 16:59
A gitignore file for initializing a git repository in the root file system. Because the include list is a white list of files there aren't any issues with repositories being in a sub tree. This .gitignore file is in the `/` filesystem where there is a git repository at `/.git`. The name of this repository on the central server is the domain name…
#Track iptables
#the order of the patterns matter because we want to track a child but not any parents
#http://stackoverflow.com/questions/5533050/gitignore-exclude-folder-but-include-specific-subfolder
#global types to ignore
*.swp
#include all directories and files to be ignored completely
/app
@samrocketman
samrocketman / how_to_ruby.md
Last active December 27, 2015 00:28
This is a guide for the recommended method of installing Ruby from source.

This is a guide for the recommended method of installing Ruby.

Learn more about Ruby.

Ruby 1.8.7

RHEL 6.4 currenly only supports ruby 1.8.7 in the repositories which has been completely dropped which is currently in security maintenance only. Therefore it's recommended to manage ruby outside of the yum package management and build completely from source.

Install libyaml from source

@samrocketman
samrocketman / sshd_config
Last active December 27, 2015 02:59
/etc/ssh/sshd_config append to disable password auth for SSH on the git user only.
Match User git
PasswordAuthentication no
@samrocketman
samrocketman / sslTest.java
Created November 1, 2013 18:28
A java file which will aide in testing certificate validation of a service.
//javac 1.6.0_31
/*
Compile:
javac sslTest.java
Usage (similar to telnet):
java sslTest somehost someport
e.g.
java sslTest my.gitlabhost.com 443
@samrocketman
samrocketman / managing_and_upgrading_gitlab.md
Last active May 29, 2017 04:32
A sane admin workflow for managing your GitLab instance.

Sane GitLab management for an Admin

I've seen it asked a couple of times in #gitlab on freenode about upgrading GitLab and what is a good method or recommended method. While GitLab HQ does not recommend a specific workflow for their upgrades I am here to introduce you to my work flow. Feel free to use it or adapt it to your own style. Please note I wrote the majority of this around GitLab 6.0 but GitLab 6.2 is currently released. This will likely apply to any future GitLab release if they stick to the same model of releasing via SCM.

If you'd like to follow other stuff I write about randomly I have a LinuxQuestions.org blog under the user sag47 or you can look at my recent posts on LinuxQuestions.org by doing an advanced search and search by user name. I try to make them all informative.

A GitLab major version is released on the 22nd of each month. Each release has it's own upgrad

@samrocketman
samrocketman / ubuntu_1204_import_ca.md
Last active October 14, 2021 00:36
Adding certificate authorities to Ubuntu 12.04

Overview

If you're able to visit a website and it successfully validates but you're not able to curl the website (i.e. you get certificate validation errors) then it is likely because your root certificate, or intermediate certificate, or both are not trusted in your system. Ubuntu provides an easy process for updating the root certificate stores using the update-ca-certificates command and the /etc/ca-certificates.conf for configuration.

Add CA and Intermediates to Ubuntu

Certificates should be installed under /usr/share/ca-certificates. You should create a directory for your org to place all certs and intermediates.

mkdir /usr/share/ca-certificates/my.org/