This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
<dependency> | |
<groupId>org.apache.directory.server</groupId> | |
<artifactId>kerberos-client</artifactId> | |
<version>2.0.0-M20</version> | |
</dependency> | |
*/ | |
public static void main(String[] args) { | |
KdcConfig config = KdcConfig.getDefaultConfig(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#this looks up the nodes from the ring and rebalances them automatically | |
hosts = `/usr/bin/nodetool ring |grep Normal |awk '{print $1}' |xargs echo` | |
RING_SIZE=$(echo "2^127" | bc) | |
HOST_NUM=$(echo $hosts | wc -w) | |
INDEX=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Make sure the python-ldap module is installed | |
# pip install python-ldap | |
import ldap | |
import ldap.sasl | |
#Initialize your connection and force it to use TLS | |
con = ldap.initialize('ldap://ldap.example.com') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ReadVeryBigFile { | |
public static void main(String[] args) throws Exception { | |
Runtime runtime = Runtime.getRuntime(); | |
NumberFormat format = NumberFormat.getInstance(); | |
long startedMemory = runtime.freeMemory(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: UTF8 -*- | |
import json | |
import urllib2 | |
def make_get_request(url, headers): | |
req = urllib2.Request(url=url, headers=headers) | |
return json.loads(urllib2.urlopen(req).read()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void putObject(final InputStream inputStream, final String objectName, final int bufferSize) throws Exception { | |
int length = inputStream.available(); | |
byte[] buffer = new byte[bufferSize]; | |
int bytesRead; | |
int offset = 0; | |
logger.info("Copying file with objectName: {}", objectName); | |
MessageDigest md = MessageDigest.getInstance("MD5"); | |
while ((bytesRead = inputStream.read(buffer)) > 0) { | |
md.update(buffer, 0, bytesRead); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
:hierarchy: | |
- roles/%{::irn_role} | |
- common | |
:backends: | |
- yaml | |
:merge_behavior: deeper | |
:yaml: | |
:datadir: '/puppet/hieradata/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
PUPPET_DIR="my-puppet-dir" | |
Vagrant.configure(2) do |config| | |
config.vm.box = "ubuntu/trusty64" | |
# config.vm.network "forwarded_port", guest: 80, host: 8080 | |
# config.vm.network "private_network", ip: "192.168.33.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
try: | |
import rados | |
import sys | |
import hashlib | |
import argparse | |
import os | |
import logging | |
except ImportError: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
try: | |
import rados | |
import sys | |
import hashlib | |
import os | |
except ImportError: | |
raise ImportError('unable to import modules') | |
sys.stderr.write("unable to import modules") |