Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am makuk66 on github.
  • I am makuk66 (https://keybase.io/makuk66) on keybase.
  • I have a public key whose fingerprint is 30DC B2AE 2281 E3E0 46BF 0472 521F B994 999F A9CA

To claim this, I am signing this object:

@makuk66
makuk66 / every21days.py
Last active August 29, 2015 14:04
python date for alug
import datetime
date=datetime.date(2014,7,17)
print('{d}'.format(d=date))
for _ in range(12):
date=date+datetime.timedelta(days=21)
print('{d}'.format(d=date))
@makuk66
makuk66 / install-oracle-java7.sh
Last active August 29, 2015 14:06
install oracle java7
#!/bin/bash -eux
apt-get install -y git-core curl wget python-yaml build-essential libssl-dev
locale-gen en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
apt-get -y install python-software-properties software-properties-common
hash -r
add-apt-repository ppa:webupd8team/java
@makuk66
makuk66 / gist:20b04e4a8e4ff682714f
Last active August 29, 2015 14:12
fix solrResourceLoader for https://issues.apache.org/jira/browse/SOLR-6887. This patch is placed in the public domain.
diff --git a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
index 9cbd048..86902c4 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
@@ -175,21 +175,41 @@ public class SolrResourceLoader implements ResourceLoader,Closeable
*/
void addToClassLoader(final String baseDir, final FileFilter filter, boolean quiet) {
File base = FileUtils.resolvePath(new File(getInstanceDir()), baseDir);
- if (base != null && base.exists() && base.isDirectory()) {
- File[] files = base.listFiles(filter);
#!/bin/sh
# dhclient change hostname script for Ubuntu
oldhostname=$(hostname -s)
if [ $oldhostname = 'localhost' ]
then
sleep 10 # Wait for configuration to be written to disk
hostname=$(cat /var/lib/dhcp/dhclient.eth0.leases | awk ' /host-name/ { host = $3 } END { printf host } ' | sed 's/[";]//g' )
fqdn="$hostname.$(cat /var/lib/dhcp/dhclient.eth0.leases | awk ' /domain-name/ { domain = $3 } END { printf domain } ' | sed 's/[";]//g')"
ip=$(cat /var/lib/dhcp/dhclient.eth0.leases | awk ' /fixed-address/ { lease = $2 } END { printf lease } ' | sed 's/[";]//g')
echo "cloudstack-hostname: Hostname _localhost_ detected. Changing hostname and adding hosts."
@makuk66
makuk66 / ruok.rs
Last active September 11, 2015 19:16
zookeeper "ruok" client, which properly reports errors, including the server address on connect.
use std::io::prelude::*;
use std::net::TcpStream;
fn main() {
let address = "192.168.0.109:9983";
let mut stream = match TcpStream::connect(address) {
Ok(s) => s,
Err(e) => panic!("Cannot connect to {}: {}", address, e)
};
stream.write("ruok".as_bytes()).ok().expect("write failed");
@makuk66
makuk66 / dd-performance
Created June 15, 2011 15:31
dd performance
For shits and giggles: some crude IO performance tests based on dd'ing a 512M file of random content, results in MB/s:
macbook 10
mail server 17
KVM virtual 17
Older MacBookPro 23
Linux Workstation 45
Mac Mini SSD 46
m1.large HD 57
m1.large EBS 63
@makuk66
makuk66 / ubuntu11.04-apt.erb
Created July 19, 2011 16:41
Chef knife ec2 server create template for Natty, with node name prefix
# This is a knife ec2 server create template for Ubuntu 11.4.
# It is based on the 10.4 version in the 0.10.2 Chef distribution available here:
# https://github.com/opscode/chef/blob/master/chef/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb
# with modifications to:
# - use the natty APT repository
# - install Chef 0.10.2
# - avoid starting the /etc/init.d/chef-client service until the client.rb has been written
# - allow a CHEF_NODE_NAME_PREFIX environment variable to prefix to the node name
bash -c '
mak@crab 516 solr-5.3.0 $ diff -du bin/solr.orig bin/solr
--- bin/solr.orig 2015-09-29 21:41:32.000000000 +0100
+++ bin/solr 2015-09-29 21:41:48.000000000 +0100
@@ -1304,7 +1304,7 @@
if [ "$run_in_foreground" == "true" ]; then
echo -e "\nStarting Solr$IN_CLOUD_MODE on port $SOLR_PORT from $SOLR_SERVER_DIR\n"
- "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -jar start.jar "${SOLR_JETTY_CONFIG[@]}"
+ exec "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -jar start.jar "${SOLR_JETTY_CONFIG[@]}"
else
@makuk66
makuk66 / gist:2106616
Created March 19, 2012 10:20
jenkins apache rewrite example
<VirtualHost jenkins.mydomain.com:443>
...
RewriteEngine On
RewriteRule ^/$ /jenkins/ [R]
ProxyRequests Off
ProxyPreserveHost on
ProxyPass /jenkins/ http://localhost:8080/jenkins/
<Location /jenkins/>
ProxyPassReverse /