Skip to content

Instantly share code, notes, and snippets.

View samrocketman's full-sized avatar

Sam Gleske samrocketman

View GitHub Profile
@samrocketman
samrocketman / sample.cpp
Created October 7, 2014 23:18
A sample c++ function.
#include <iostream>
using namespace std;
int add(int a, int b)
{
return a+b;
}
int main(void)
@samrocketman
samrocketman / iptables.rules
Created May 6, 2014 19:09
iptables rules for GitLab
#iptables config for gitlab
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
#:OUTPUT DROP [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
@samrocketman
samrocketman / gitlab-version-chech.sh
Created April 28, 2014 15:29
A simple bash script for checking the latest stable version of GitLab
#!/bin/bash
#Sam Gleske
#Mon Apr 28 11:11:10 EDT 2014
#Red Hat Enterprise Linux Server release 6.5 (Santiago)
#Linux 2.6.32-431.el6.x86_64 x86_64
#GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
#DESCRIPTION
# Check the latest stable version and compare with the version of gitlab installed.
# Run daily via cron.
@samrocketman
samrocketman / gitlab_gemoji.patch
Created April 8, 2014 22:45
Revert GitLab back to gemoji
diff --git a/Gemfile b/Gemfile
index 195de7b..84bb745 100644
--- a/Gemfile
+++ b/Gemfile
@@ -164,7 +164,7 @@ gem "jquery-ui-rails", "2.0.2"
gem "raphael-rails", "~> 2.1.2"
gem 'bootstrap-sass', '~> 3.0'
gem "font-awesome-rails", '~> 3.2'
-gem "gitlab_emoji", "~> 0.0.1.1"
+gem "gemoji", "~> 1.3.0"
@samrocketman
samrocketman / ssh_aliases.md
Created April 2, 2014 20:13
Aliasing hosts using ssh `config`.

In ~/.ssh/config you can specify host aliases. For example, let's say you have two different keys you want to use for the same user living on the same host. You would do that in the following manner... (excerpt from ~/.ssh/config)

Host localhost
  User git
  IdentityFile /home/systems/.ssh/id_rsa
Host myaliashost
  HostName localhost
  User git
 IdentityFile /home/systems/.ssh/another_id_rsa
@samrocketman
samrocketman / jenkins_home_gitignore.md
Last active April 19, 2019 17:29
Use JENKINS_HOME as a git repository with the following .gitignore file.

I initialze $JENKINS_HOME as a git repository with the following .gitignore file.

#global types to ignore
*.swp

#Only get job configs and ignore other data
!jobs/*
jobs/*/*
!jobs/*/config.xml
@samrocketman
samrocketman / gitlab_remote_backup_recovery.md
Last active August 29, 2015 13:56
Backup gitlab from the CLI to a remote system when you're either out of space or the filesystem is readonly.

Backup from GitLab to remote machine

If you have a readonly system on your GitLab system then this method is recommended. Log into root user of your gitlab system.

cat ~git/gitlab/config/database.yml to get your database credentials and backup DB to remote system.

unset HISTFILE
/usr/bin/mysqldump -u GITLAB_DB_USER_CHANGEME -pGITLAB_DB_PASS_CHANGEME --skip-extended-insert --create-options --databases GITLAB_DATABASE_CHANGEME | gzip -c - | ssh [email protected] 'cat > gitlab_backup_db.mysql.gz'

Backup repositories.

@samrocketman
samrocketman / iptables.rules
Created January 28, 2014 22:07
Simple iptables rules
#load firewall config with iptables-restore < iptables.rules
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
#The following rules required for normal communication
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -i lo -j ACCEPT
@samrocketman
samrocketman / gitlab_install.md
Created January 28, 2014 16:44
I created this quick snippet of how to install GitLab on RHEL6 for my own reference and for others.

Gitlab Installation Instructions on RHEL6/CentOS6

Installation Procedure

Bits of this were taken from the unofficial guide for CentOS 6.

User

If you plan on installing the user by default in /home then just add a user as you normally would. I customized the git user home to a different volume.

@samrocketman
samrocketman / compile_git.md
Last active October 24, 2022 06:03
Compiling git

The version of git that comes with RHEL6 is very old. I'll outline steps for compiling the latest git version on RHEL6. Working from /usr/local/src.

Following instructions for Git Pro book Getting Started Installing Git.

Prerequisites

yum install gcc curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker

Optional man page prereqs.