Skip to content

Instantly share code, notes, and snippets.

@drelu
drelu / example-webhdfs.py
Created December 28, 2011 20:07
WebHDFS Python Example
from webhdfs.webhdfs import WebHDFS
import os, tempfile
import time
webhdfs = WebHDFS("localhost", 50070, "luckow")
webhdfs.mkdir("/hello-world/")
# create a temporary file
f = tempfile.NamedTemporaryFile()
@7171u
7171u / Cntlm Authentication Proxy for Docker.txt
Last active April 5, 2019 17:43
Docker Behind Proxy Network with Cntlm on Centos/RHEL
Install and Configure Cntlm:
1. Configure EPEL Repo and install cntlm
yum install cntlm
3. Generate hashes for password-less configuration and add one of the values to /etc/cntlm.conf
cntlm -u <user>@<domain> -H
3. vi /etc/cntlm.conf
Username <Username>
Domain <Domain>
PassNTLMv2 BCB555F5BA8709B8186C2A813C47A4BD # Only for user '<user>', domain '<domain>'
Proxy <ProxyServer>:<Port>
@cnauroth
cnauroth / gist:7ff52e9f80e7d856ddb3
Created June 11, 2015 15:18
Hadoop NameNode JMX REST Query for NameNodeStatus
> curl 'http://172.20.11.177:50070/jmx?qry=Hadoop:service=NameNode,name=NameNodeStatus'
{
"beans" : [ {
"name" : "Hadoop:service=NameNode,name=NameNodeStatus",
"modelerType" : "org.apache.hadoop.hdfs.server.namenode.NameNode",
"State" : "active",
"NNRole" : "NameNode",
"HostAndPort" : "localhost:19000",
"SecurityEnabled" : false,
"LastHATransitionTime" : 0
@zhujunsan
zhujunsan / Using Github Deploy Key.md
Last active June 4, 2024 10:08
Using Github Deploy Key

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process in replace of username/password, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key
@dreikanter
dreikanter / encrypt_openssl.md
Last active June 20, 2024 10:15 — forked from crazybyte/encrypt_openssl.txt
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

@houtianze
houtianze / sysv.init.script.to.systemd.unit.file.md
Last active May 8, 2024 18:15
Convert SysV Init scripts to Systemd Unit File

Let's say you have a SysV Init Script named foo

  1. Copy the file to /etc/init.d/foo

  2. Enable the SysV service: chkconfig --add foo

  3. Enable the SysV service: chkconfig foo on

  4. Start the service: service foo start. After this, systemd-sysv-generator will generate this file /run/systemd/generator.late/foo.service, copy this file to /etc/systemd/system by running: cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service

  5. Edit /etc/systemd/system/foo.service by running systemctl edit foo.service, add in the following line to foo.servie (this makes the service installable)

[Install]

@wesm
wesm / parquet-benchmark-20170210.py
Created February 10, 2017 18:07
Parquet multithreaded benchmarks
import gc
import os
import time
import numpy as np
import pandas as pd
from pyarrow.compat import guid
import pyarrow as pa
import pyarrow.parquet as pq
import snappy
@monodot
monodot / ssl-testing.md
Last active April 21, 2022 13:00
Using openssl to test an SSL connection with a CA file, pulled out from a Java keystore

Java, do you trust me? 🤔

Using openssl to test an SSL connection to google.com, using a CA file that's been pulled out from a Java keystore. For those days when you want to verify that you've got the right certificate in the store:

  1. Download the Equifax root certificate (which is the root CA for Google)
  2. Import the certificate into a new Java keystore
  3. Export the certificate back out again
  4. Convert the certificate to PEM
  5. Use openssl to test an SSL connection to Google with that cert
@djraw
djraw / convert-jks-to-pem.txt
Created March 3, 2018 17:04
Export private key from a Java Keytool keystore to pem
Use Java keytool to convert from JKS to P12...
Export from keytool's proprietary format (called "JKS") to standardized format PKCS #12:
keytool -importkeystore -srckeystore keystore.jks -destkeystore keystore.p12 -deststoretype PKCS12 -srcalias <jkskeyalias> -deststorepass <password> -destkeypass <password>
...then use openssl to export from P12 to PEM
Export certificate using openssl:
@abhirockzz
abhirockzz / create-redis-cluster.sh
Created August 31, 2018 11:51
Use redis-cli to create a Redis Cluster on Docker (with Redis 5.0)
#------------ bootstrap the cluster nodes --------------------
start_cmd='redis-server --port 6379 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes'
redis_image='redis:5.0-rc'
network_name='redis_cluster_net'
docker network create $network_name
echo $network_name " created"
#---------- create the cluster ------------------------