Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View hobbes3's full-sized avatar
😅

Satoshi Kawasaki hobbes3

😅
View GitHub Profile
@hobbes3
hobbes3 / kml_get_centroid.py
Last active September 10, 2019 23:35
KML get centroid
#!/usr/bin/env python
# hobbes3
import xml.etree.ElementTree as ET
import csv
from statistics import mean
KML_FILE = "sf_blocks.kml"
CSV_FILE = "sf_blocks_lat_lon.csv"
CSV_COLUMNS = ["BLKLOT", "lat", "lon"]
@hobbes3
hobbes3 / ubuntu_install_bash.sh
Last active January 31, 2020 02:15
ubnutu install splunk config
# Must run as root
NAME="my_server"
SSH_PORT=9922
hostnamectl set-hostname $NAME
# SSH
echo -e "\nPort $SSH_PORT" >> /etc/ssh/sshd_config
service ssh restart
@hobbes3
hobbes3 / reset_dashboard.xml
Last active April 20, 2019 02:03
splunk dashboard reset button xml simplexml
<!-- Provided by Gleb Esman -->
<html>
<div>
<a type="button" style="margin-bottom: 10px;" class="btn" href="/app/$env:app$/$env:page$">Reset dashboard</a>
</div>
</html>
@hobbes3
hobbes3 / install_stuff_on_amazon_linux_2.sh
Last active July 11, 2019 07:19
amazon linux 2 python pyenv node nodejs install yum
# Running as root
### PYENV
yum install -y git gcc gcc-c++ make git patch openssl-devel zlib-devel readline-devel sqlite-devel bzip2-devel zlib libffi-devel
# Switch to the user that will use pyenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
. ~/.bash_profile
@hobbes3
hobbes3 / git_mass_pull.sh
Created January 16, 2019 07:03
git pull cluster master mass find
find /opt/splunk/etc/master-apps/ -name ".git" -exec dirname {} \; | xargs -I {} sh -c "echo {}; git -C {} pull;"
@hobbes3
hobbes3 / mass_index_old.py
Created January 11, 2019 03:39
mass index indexing splunk nom on add oneshot multiprocessing
#!/usr/bin/env python
# hobbes3
import os
import time
import sys
import glob
import subprocess
import pexpect
import logging
@hobbes3
hobbes3 / add_irs_990_old.py
Last active April 18, 2019 22:44
irs 990 add oneshot onboard multithread multithreading concurrent splunk4good nom on
#!/usr/bin/env python
# hobbes3
# A way to handle indexing 2+ million XML files in a single directory (synced from a S3 bucket)
import glob
import time
import logging
import logging.handlers
import subprocess
@hobbes3
hobbes3 / splunk.conf
Last active February 5, 2019 20:53
syslog-ng syslog conf splunk
@version: 3.5.6
# Typically placed as /etc/syslog-ng/conf.d/splunk.conf
options {
create-dirs(yes);
owner("splunk");
group("splunk");
dir-owner("splunk");
@hobbes3
hobbes3 / visualization_source.js
Last active May 17, 2017 00:47
custom visualization template source src
define([
'jquery',
'underscore',
'd3',
'api/SplunkVisualizationBase',
'api/SplunkVisualizationUtils'
],
function(
$,
_,
import cherrypy
import json
import pprint
import logging
import splunk.appserver.mrsparkle.controllers as controllers
from splunk.appserver.mrsparkle.lib.decorators import expose_page
from splunk.appserver.mrsparkle.lib.routes import route
from splunk.appserver.mrsparkle.lib.util import make_url
def setup_logger(modulename):