Skip to content

Instantly share code, notes, and snippets.

View colossus9's full-sized avatar
:shipit:
Ship to Learn

James Garcia colossus9

:shipit:
Ship to Learn
View GitHub Profile
@colossus9
colossus9 / git_speed.md
Last active April 3, 2019 02:06 — forked from emanuelez/git_speed.md
Git Speed

How Fast is Git?

The web is full of benchmarks showing the supernatural speed of Git even with very big repositories, but unfortunately they use the wrong variable. Size is not important, but the number of files in the repository really is!

Why is that? Well, that's because Git works in a very different way compared to Synergy. You don't have to checkout a file in order to edit it; Git will do that for you automatically. But at what price?

The price is that for every Git operation that requires to know which files changed (git status, git commmit, etc etc) an lstat() call will be executed for every single file

Wow! So how does that perform on a fairly large repository? Let's find out! For this example I will use an example project, which has 19384 files in 1326 folders.

@colossus9
colossus9 / README.md
Created October 25, 2018 10:18 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@colossus9
colossus9 / polling-searches-on-ghe.md
Created March 15, 2017 17:54
Polling Searches on GHE

Polling Searches on GHE

How can you determine what is polling your GitHub Enterprise system? If you suspect polling, this data will help you pinpoint where it is coming from. Don't just tell your users "stop polling", get the data and tell them where it is coming from.

Number of requests in 10 minute intervals

When reviewed over a 24-hour period, consistent numbers in non-peak hours indicates likely polling with short intervals. Longer polling intervals also stand out, often as a burst of high traffic each hour on the hour.

$ cut -c 1-15 /var/log/babeld/babeld.log | uniq -c
@colossus9
colossus9 / Jenkinsfile
Created January 19, 2017 16:18 — forked from chinshr/Jenkinsfile
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}
@colossus9
colossus9 / generate-arch.sh
Created December 8, 2016 20:01
Generate Service Architecture for your docker-compose.yml
#!/bin/sh
#
# Use this script to generate a Service Architecture
# for your docker-compose.yml file.
#
cd $PATH_TO_COMPOSE_FILE
cat docker-compose.yml | \
docker run -i funkwerk/compose_plantuml --link-graph --boundaries | \
@colossus9
colossus9 / get-ssh-fingerprints.sh
Created September 21, 2016 19:30
Show table of fingerprints for all key ciphers allowed on server using config at /etc/ssh/sshd_config
#!/bin/bash
#
# Reference: http://superuser.com/questions/929566/sha256-ssh-fingerprint-given-by-the-client-but-only-md5-fingerprint-known-for-se
#
# standard sshd config path
SSHD_CONFIG=/etc/ssh/sshd_config
# helper functions
function tablize {
@colossus9
colossus9 / GHE_Wiki_Find_and_Replace.md
Created August 3, 2016 20:46
Find-and-Replace text in GitHub Enterprise (repo) Wiki pages

Perform a Mass Find-and-Replace in a GitHub Enterprise Wiki

If you have a need to update text/string in your GitHub Enterprise wiki, and you have many wikis where manual find-and-replace can be tedious, one way to perform a mass update is to clone your wiki (as a git repository) to a local workspace and perform find-and-replace.

Here is an example of using the Unix-based sed command to perform a find-and-replace:

  1. Access your repository's wiki site. Example: https://git.521000.bestpany.com/OWNER/REPO/wiki
@colossus9
colossus9 / GitRemoteBranchSync.md
Created August 3, 2016 20:44
Local git branch list "synchronization" with remote

Git Remote Branch Sync

There are some folks who want to keep their local git branch list to be in sync with the branches available on the remote. This typically happens after a Pull Request on GitHub Enterprise, when the remote branch is merged and removed, but the branch still exists locally.

To clean up the branches that no longer exist on the remote, there are a couple of options (as well as more that are not listed here):

  • The quick way:
@colossus9
colossus9 / Gerrit-GitHub.md
Created August 3, 2016 20:43
Gerrit with GitHub

Gerrit GitHub Plugin

This plugin allows existing GitHub repositories to be integrated as Gerrit projects. This plugin works for Gerrit 2.12 and later versions. See the original opensource project for more information.

Have a working instance of Gerrit 2.12

  1. Download the Gerrit 2.12 war file.
  2. Create a directory for Gerrit mkdir gerrit
@colossus9
colossus9 / git-history.md
Created August 3, 2016 20:38
git history pretty

git log --pretty=format:"%h - %an, %ar : %s"