Skip to content

Instantly share code, notes, and snippets.

View danmikita's full-sized avatar
🦊
Gettin' foxy with it

Dan Mikita danmikita

🦊
Gettin' foxy with it
View GitHub Profile
@agnoster
agnoster / README.md
Last active September 25, 2024 09:27
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@danmikita
danmikita / git_push_deployments.md
Last active December 21, 2015 09:08
In an enterprise it can be very important to track the release version of various applications. In an attempt to simplify how we track old releases, as well as how we roll back to previous versions, I wanted to find a way to use git push to deploy various git tags. This would allow for a more standard approach to deploys within our organization.

Git Push Deployments

Some Background Information

In git, a tag (like many other things) is what's called a treeish. It's a way of referring to a point in the history of the project. Treeishes can be a tag, a commit, a date specifier, an ordinal specifier or many other things. A branch is just like a tag but is movable. When you are on a branch and make a commit, the branch is moved to the new commit you made indicating it's current position.

Your HEAD is a pointer to a branch which is considered "current". Usually when you clone a repository, HEAD will point to master which in turn will point to a commit. When you then do something like git checkout experimental, you switch the HEAD to point to the experimental branch, which might point to a different commit.

When you do a git checkout v2.0 (v2.0 in this case is a tag), you are switching to a commit that is not pointed to by a branch. The HEAD is now "detached" and not po

@chalup
chalup / GagSsl.java
Created January 30, 2014 11:30
Get OkHttpClient which ignores all SSL errors.
private static OkHttpClient getUnsafeOkHttpClient() {
try {
// Create a trust manager that does not validate certificate chains
final TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
# Shortcut for a module under development
def dev(name, *args)
mod "boxen-#{name}", :path => "#{ENV['BOXEN_SRC_DIR']}/boxen/puppet-#{name}"
end
dev "boxen", #... Any args after this get ignored, for convenience
@ssinss
ssinss / EndlessRecyclerOnScrollListener.java
Last active January 19, 2024 08:52
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
@lapastillaroja
lapastillaroja / DividerItemDecoration.java
Last active November 17, 2023 23:06 — forked from akmalxxx/DividerItemDecoration.java
DividerItemDecoration. RecyclerView.ItemDecoration simple implementation
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
@luxas
luxas / Dockerfile
Last active November 29, 2017 16:10
Build Kubernetes binaries for ARM on amd64
FROM golang:1.5.2
MAINTAINER Lucas Käldström <[email protected]>
# Enable cgo cross-compilation for armel
RUN echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.list.d/crosstools.list \
&& curl -s http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add - \
&& dpkg --add-architecture armel \
&& apt-get update \
&& apt-get install -y build-essential crossbuild-essential-armel rsync upx
@simonswine
simonswine / copy-k8s-resources-across-namespaces.sh
Created August 2, 2016 13:40
Copying kubernetes resources accross namespaces
kubectl get rs,secrets -o json --namespace old | jq '.items[].metadata.namespace = "new"' | kubectl create-f -
@ram535
ram535 / gist:b1b7af6cd7769ec0481eb2eed549ea23
Last active February 2, 2023 12:25
Reuse the same terminal in neovim.
" With this function you can reuse the same terminal in neovim.
" You can toggle the terminal and also send a command to the same terminal.
let s:monkey_terminal_window = -1
let s:monkey_terminal_buffer = -1
let s:monkey_terminal_job_id = -1
function! MonkeyTerminalOpen()
" Check if buffer exists, if not create a window and a buffer
if !bufexists(s:monkey_terminal_buffer)