Skip to content

Instantly share code, notes, and snippets.

View millerjp's full-sized avatar

Johnny Miller millerjp

View GitHub Profile
@millerjp
millerjp / gist:58495a4b0f09890ec273
Last active August 29, 2015 14:22
After replacing trackpad on W540, add this to /usr/share/X11/xorg.conf.d/20-thinkpad.conf on Mint 17.1 to get middle button scrolling working
Section "InputClass"
Identifier "Touchpad/TrackPoint"
MatchProduct "PS/2 Generic Mouse"
MatchDriver "evdev"
Option "EmulateWheel" "1"
Option "EmulateWheelButton" "2"
Option "Emulate3Buttons" "0"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
EndSection
@nstielau
nstielau / gist:3373649
Created August 16, 2012 21:03
Remove an unreachable node from Cassandra via JMX
wget http://jmxsh.googlecode.com/files/jmxsh-R5.jar
java -jar jmxsh-R*.jar -h localhost -p 7199
% [Hit Enter to go into Browse Mode]
Select a domain: [Enter number for org.apache.cassandra.net]
Select an mbean: [Enter number for org.apache.cassandra.net:type=Gossiper]
Select an attribute or operation: [Enter number for unsafeAssassinateEndpoint(String p1)]
p1 (String): [Enter IP address of problem node]
It may also be possible to run it directly (untested):
% jmx_invoke -m org.apache.cassandra.net:type=Gossiper unsafeAssassinateEndpoint <STALE-IP-ADDRESS>
@Kami
Kami / cassandra_cfstats_histogram.py
Last active October 13, 2015 04:58
Turns output of Cassandra nodetool cfhistograms into pretty graphs (histograms)
#!/usr/bin/env python
# Licensed to Tomaz Muraus under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# Tomaz muraus licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@Kami
Kami / cassandra_cfhistograms_to_histogram.py
Last active December 11, 2017 10:34
Turns output of Cassandra nodetool cfhistograms command into pretty graphs (histograms)
#!/usr/bin/env python
# Licensed to Tomaz Muraus under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# Tomaz muraus licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@benhosmer
benhosmer / udp-port-scanning.txt
Created April 20, 2012 15:31
UDP Port Troubleshooting using netcat
Using the nc command you can scan a port or a range of ports to verify whether a UDP port is open and able to receive traffic.
This first command will scan all of the UDP ports from 1 to 65535 and add the results to a text file:
$ nc -vnzu server.ip.address.here 1-65535 > udp-scan-results.txt
This merely tells you that the UDP ports are open and receive traffic.
Perhaps a more revealing test would be to actually transfer a file using UDP.
@massive
massive / locale_diff.rb
Created November 29, 2010 13:51
Compares two YAML locale files and displays the difference
# Run: curl https://gist.github.com/raw/719970/locale_diff.rb | ruby - en fi
require 'rubygems'
require 'yaml'
l1 = ARGV[0]
l2 = ARGV[1]
first = YAML.load_file(l1 + ".yml")
second = YAML.load_file(l2 + ".yml")
def diff(root, compared, structure = [])
@bcantoni
bcantoni / Vagrantfile
Created September 15, 2014 22:20
Example of passing a host environment variable through to a guest, using Vagrant script provisioner
# -*- mode: ruby -*-
# vi: set ft=ruby :
# test setting a guest environment variable based on a host environment variable
# if FOO_BAR is set locally, create command to add it to .profile in the guest
env_var_cmd = ""
if ENV['FOO_BAR']
value = ENV['FOO_BAR']
env_var_cmd = <<CMD
@dsc
dsc / jconsole-proxy.sh
Created August 7, 2012 01:15
jconsole via ssh proxy
#!/bin/bash
#/ jc -- jconsole via ssh proxy
#/
#/ Usage: jc [options] HOST JMX_PORT [PROXY_PORT=JMX_PORT] [JMX_HOST=HOST]
#/
#/ Starts a SOCKS proxy via ssh to connect to a
#/ JVM running on a remote and protected machine.
#/
#/ Arguments:
@fernandoaleman
fernandoaleman / Linux Static IP
Created March 23, 2012 16:20
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@alopresto
alopresto / gpg_git_signing.md
Last active January 18, 2024 22:42
Steps to enable GPG signing of git commits.

If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

  1. Generate and add your key to GitHub
  2. $ git config --global commit.gpgsign true ([OPTIONAL] every commit will now be signed)
  3. $ git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)
  4. $ git config --global alias.logs "log --show-signature" (now available as $ git logs)
  5. $ git config --global alias.cis "commit -S" (optional if global signing is false)
  6. $ echo "Some content" >> example.txt
  7. $ git add example.txt
  8. $ git cis -m "This commit is signed by a GPG key." (regular commit will work if global signing is enabled)