Skip to content

Instantly share code, notes, and snippets.

jamshid

  • Austin, Texas, US
View GitHub Profile
View PAMTest.java
/**
* Can download libpam4j and JNA jars from:
* http://mvnrepository.com/artifact/org.kohsuke/libpam4j
* https://github.com/twall/jna
* https://github.com/matthiasblaesing/libpam4j/commits/gc_and_threadsave
*
* SETUP: useradd zuser1 ; echo zuser1:password | chpasswd ; useradd zuser2 ; echo zuser2:password | chpasswd
* BUILD 1.8: javac -classpath ./jna-4.0.0.jar:./libpam4j-1.8.jar:. PAMTest.java
* BUILD 1.9X: javac -classpath ./jna-4.1.0.jar:./libpam4j-1.9X.jar:. PAMTest.java
* FAILS: sudo java -classpath ./jna-4.0.0.jar:./libpam4j-1.8.jar:. PAMTest zuser1:password zuser2:password
View PamTest.java
/**
* If you get a strange JVM crash on CentOS 6 in code related to JNA and PAM,
* try uninstalling this RedHat package related to fingerprint scanners:
*
* sudo yum remove fprintd-pam
*
* Run this program with 100-500 threads -- the jvm usually crashes with
* a stack like below (from hs_error.log ). Probably related to issues like:
* https://bugzilla.redhat.com/show_bug.cgi?id=1010844.
* Probably also affected by machine resource limits.
@jamshid
jamshid / install-python2.7-centos6
Last active Feb 7, 2016
Is this really the best way to install python2.7 on CentOS?
View install-python2.7-centos6
yum install -y bzip2-devel zlib zlib-devel openssl openssl-devel
cd /opt
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local
make && make altinstall
cd /tmp
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
@jamshid
jamshid / update-hosts.sh
Last active Jul 29, 2018
Docker environment hack, to put the names of running containers in /etc/hosts
View update-hosts.sh
#!/bin/bash
# An alternative to "links", run this script after starting or stopping any
# container. It's a hack to update the host machine (vagrant) /etc/hosts with
# the current active docker containers and tell dnsmasq to refresh.
#
# Then start each machine with "-dns ${DOCKER_HOST_IP}", e.g.
# $ docker run -d -name mycontainer1 -dns 10.0.3.1 MYPRODUCT
# You can't seem to set the DNS during "docker build".
#
# Diagnostic command to run in host or while logged into containers:
You can’t perform that action at this time.