Skip to content

Instantly share code, notes, and snippets.

View identifysun's full-sized avatar

Jian Sun identifysun

View GitHub Profile
@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@dsc
dsc / git-fat-pack.sh
Created June 13, 2012 17:53
Permanently remove crap from a git repo.
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs
# set the internal field spereator to line break, so that we can iterate easily over the verify-pack output
@kgaughan
kgaughan / gist:3772976
Created September 23, 2012 20:37
Aggressively compact a git repository
git fsck --unreachable
git reflog expire --expire=0 --all
git repack -a -d -l
git prune
git gc --aggressive
@justlaputa
justlaputa / jenkins-api.md
Last active May 17, 2024 14:53
Jenkins Json API

jobs

jenkins_url + /api/json?tree=jobs[name,color]

builds

jenkins_url + /job/${job_name}/api/json?tree=builds[number,status,timestamp,id,result]

last build

@neelsmith
neelsmith / instanceFromName.groovy
Last active February 11, 2024 15:52
groovy: get an instance of a class from its name as a string
def objectInstance = Class.forName("NAME.AS.STRING").newInstance()
@ekristen
ekristen / check_docker_container.sh
Last active July 15, 2024 09:29
Bash Script for Nagios to Check Status of Docker Container
#!/bin/bash
# Author: Erik Kristensen
# Email: erik@erikkristensen.com
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# Depending on your docker configuration, root might be required. If your nrpe user has rights
# to talk to the docker daemon, then root is not required. This is why root privileges are not
@labnol
labnol / index.html
Created April 30, 2014 13:27
Google Maps
<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d56790.47490202523!2d78.042155!3d27.175014999999924!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x39747121d702ff6d%3A0xdd2ae4803f767dde!2sTaj+Mahal!5e0!3m2!1sen!2s!4v1398864446719" width="800" height="600" frameborder="0" style="border:0"></iframe>
@issue2k
issue2k / gist:f70a46f13e7657003750
Created September 23, 2014 11:13
Gradle github release task with single asset upload example
import org.kohsuke.github.GitHub
import org.kohsuke.github.GHRepository
import org.kohsuke.github.GHOrganization
import org.kohsuke.github.GHReleaseBuilder
import org.kohsuke.github.GHRelease
class GithubReleaseTask extends DefaultTask {
@Input
public String authToken

Problem: I needed to test some code that would auto-reconnect to a remote service, without being able to stop/restart the service.

Solution: tcpkill

For example:

apt-get install dsniff

sudo tcpkill -i eth0 port 27017 # no more outgoing connections to Mongodb