Skip to content

Instantly share code, notes, and snippets.

@wjsl
wjsl / floof
Created December 4, 2019 06:31
sudo perl -pi -e "s/\[security\]/\[security\]\nforce_https_protocol=PROTOCOL_TLSv1_2/g" /etc/ambari-agent/conf/ambari-agent.ini
sudo perl -pi -e "s/platform_default/disable/g" /etc/python/cert-verification.cfg
@wjsl
wjsl / Vagrantfile
Last active June 21, 2019 15:23
Hacked up fork of the CDH vagrant cluster that's floating around. Updated to use OpenJDK 8 and CDH 6.2.0.
$master_script = <<SCRIPT
#!/bin/bash
apt-get install curl -y
curl -s https://archive.cloudera.com/cm6/6.2.0/ubuntu1604/apt/cloudera-manager.list > /etc/apt/sources.list.d/cloudera-manager.list
curl -s https://archive.cloudera.com/cm6/6.2.0/ubuntu1804/apt/archive.key > key
apt-key add key
rm key
apt-get update
@wjsl
wjsl / threadtest.c
Created January 18, 2018 23:45
A demo program that exercises libyara's exception macro in a multi-threaded program
#include <pthread.h>
#include <yara.h>
#include <stdio.h>
int callback_function(int, void*, void*);
void *YaraWorker(void *);
void *Segfaulter();
void *Safebet();
typedef struct yargs_struct {
@wjsl
wjsl / yarable.c
Created July 13, 2017 21:28
Some days you just gotta write some C to stay sane
#include "yara.h"
#include "stdio.h"
int callback_function(int, void*, void*);
int main() {
int ret = yr_initialize();
YR_COMPILER* compiler = malloc(sizeof(YR_COMPILER));
int compiler_create = yr_compiler_create(&compiler);
https://github.com/apache/accumulo/blob/master/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java#L253
SampleClient {
com.sun.security.auth.module.Krb5LoginModule required
debug=true
useTicketCache=true
doNotPrompt=true
renewTGT=true
;
};
import java.io.{FileOutputStream, BufferedOutputStream, OutputStream, File}
import java.security.PrivilegedAction
import javax.security.auth.Subject
import com.google.common.io.Files
import org.apache.accumulo.cluster.ClusterUser
import org.apache.accumulo.core.client.impl.Namespaces
import org.apache.accumulo.core.client.{BatchWriterConfig, ClientConfiguration}
import org.apache.accumulo.core.client.security.tokens.KerberosToken
import org.apache.accumulo.core.conf.Property
root@miniInstance> createtable foo
2016-01-29 15:56:40,399 INFO [MiniShell.main()] Shell.audit (Shell.java:execCommand(685)) - root@miniInstance> createtable foo
root@miniInstance foo> setiter -all -class org.apache.accumulo.core.iterators.user.RowDeletingIterator -p 10
2016-01-29 15:57:01,463 INFO [MiniShell.main()] Shell.audit (Shell.java:execCommand(685)) - root@miniInstance foo> setiter -all -class org.apache.accumulo.core.iterators.user.RowDeletingIterator -p 10
2016-01-29 15:57:01,530 WARN [MiniShell.main()] vfs.AccumuloVFSClassLoader (AccumuloVFSClassLoader.java:resolve(160)) - ignoring classpath entry file:///lib/ext/[^.].*.jar
The iterator class does not implement OptionDescriber. Consider this for better iterator configuration using this setiter command.
Name for iterator (enter to skip): org.apache.accumulo.core.iterators.user.RowDeletingIterator
Optional, configure name-value options for iterator:
----------> set option (<name> <value>, hit enter to skip):
root@miniInstance foo> config -t foo -
@wjsl
wjsl / minishell.scala
Last active January 14, 2016 15:04
Quick way to get a shell to a MiniAccumulo Instance
def main(args: Array[String]): Unit = {
Logger.getLogger("org.apache.zookeeper").setLevel(Level.OFF)
val log = LoggerFactory.getLogger(getClass)
val work_dir = Files.createTempDir()
log.info("Working dir: {}", work_dir)
val password = "secret"
val accumulo = new MiniAccumuloCluster(new MiniAccumuloConfig(Files.createTempDir(), password))
var returnCode: Option[Int] = None
try {
@wjsl
wjsl / configurable_mac.scala
Created November 13, 2015 14:44
How set up MiniAccumuloCluster and set custom configuration parameters
// Similar to setting up the regular MiniAccumuloCluster, but we use the *Impl classes directly
object Demo {
def main(args : Array[String]): Unit = {
var dir: File = null
var accumulo: MiniAccumuloClusterImpl = null
try {
dir = Files.createTempDir();
dir.deleteOnExit()
println("Working in " + dir)