Skip to content

Instantly share code, notes, and snippets.

@cornet
cornet / SSLTest.java
Created September 15, 2011 15:42
Java SSL Test
/*
* Makes simple connection to SSL enabled site.
* Useful for debugging SSL Exceptions :)
*
* To Run:
* $ javac SSLTest.java
* $ java -Djavax.net.debug=all SSLTest
*
*/
import java.io.IOException;
@awilmore
awilmore / IOUtil.java
Created May 23, 2012 10:18
Fast nio InputStream to OutputStream Copy
package com.awilmore.ioutils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@4ndrej
4ndrej / SSLPoke.java
Last active January 3, 2024 09:50
Test of java SSL / keystore / cert setup. Check the comment #1 for howto.
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
@tcotav
tcotav / gist:7489860
Created November 15, 2013 19:08
Recipe snippet to join a host to AD via Powershell using Chef (Chef::Mixin::PowershellOut)
#
# set this up for reboot should we join domain successfully
#
windows_reboot 5 do
reason 'Reboot after joining AD'
action :nothing
end
#
# import mixin powershellout here
# Build the CentOS 6 release package for earlier RPM database
yum install -y rpm-build
wget -c http://vault.centos.org/6.5/os/Source/SPackages/centos-release-6-5.el6.centos.11.1.src.rpm
rpm2cpio centos-release-6-5.el6.centos.11.1.src.rpm | cpio -idmv
mv centos-release*.tar.gz /usr/src/redhat/SOURCES
rpmbuild -bb centos-release.spec
# Install hash support (to unbreak yum)
yum install -y python-hashlib
@willprice
willprice / .travis.yml
Last active June 15, 2024 04:29
How to set up TravisCI for projects that push back to github
# Ruby is our language as asciidoctor is a ruby gem.
lang: ruby
before_install:
- sudo apt-get install pandoc
- gem install asciidoctor
script:
- make
after_success:
- .travis/push.sh
env:
@ipedrazas
ipedrazas / knife cheat
Last active December 13, 2021 11:50
Hello!
# knife cheat
## Search Examples
knife search "name:ip*"
knife search "platform:ubuntu*"
knife search "platform:*" -a macaddress
knife search "platform:ubuntu*" -a uptime
knife search "platform:ubuntu*" -a virtualization.system
knife search "platform:ubuntu*" -a network.default_gateway
@jaydansand
jaydansand / ssl_test.sh
Last active December 14, 2021 13:36
Use OpenSSL to scan a host for available SSL/TLS protocols and cipher suites
#!/bin/bash
# Author: Jay Dansand, Technology Services, Lawrence University
# Date: 10/17/2014
# OpenSSL requires a port specification; default to 443.
SERVER="$1:443"
SERVER_HOST=$(echo "$SERVER" | cut -d ":" -f 1)
SERVER_PORT=$(echo "$SERVER" | cut -d ":" -f 2)
if [[ -z "$SERVER_HOST" || -z "$SERVER_PORT" ]]; then
echo "Usage: $0 host[:port] [ciphers [delay in ms]]"
@renoirb
renoirb / 0-wordpress-plugins.yaml
Last active July 28, 2016 17:38
Use Salt to install WordPress plugins using either git or zip file
# /srv/salt/wordpress/plugin_macro.sls
{#
# ref:
# - https://gist.github.com/renoirb/1b42edac44c723185c9d
# - https://gist.github.com/renoirb/af8f738f2fd16ca1eb27
# - http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#jinja-macros
# - http://www.pluginmirror.com/plugins
#}
{% macro wordpress_plugin(name, versionIdentifier, handler, wpDocroot, gitRepo=None) -%}