Skip to content

Instantly share code, notes, and snippets.

@aclisp
aclisp / java_install.sh
Last active December 8, 2016 10:22 — forked from rjurney/java_install.sh
How to automagically install Oracle JDK 1.8 on CentOS
# Install Java 1.8 in CentOS/RHEL 6.X
sudo yum remove -y java-1.6.0-openjdk
wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-linux-x64.rpm" \
-O jdk-8-linux-x64.rpm
sudo rpm -Uvh jdk-8-linux-x64.rpm
sudo alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 20000
sudo alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 20000
@aclisp
aclisp / CreateJob.sh
Created May 4, 2017 08:57 — forked from stuart-warren/CreateJob.sh
Create a job in Jenkins (or folder) using the HTTP API
# check if job exists
curl -XGET 'http://jenkins/checkJobName?value=yourJobFolderName' --user user.name:YourAPIToken
# with folder plugin
curl -s -XPOST 'http://jenkins/job/FolderName/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# without folder plugin
curl -s -XPOST 'http://jenkins/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# create folder
@aclisp
aclisp / README.md
Created May 5, 2017 13:45 — forked from polvi/README.md
HDFS of Kubernetes

Easiest HDFS cluster in the world with kubernetes.

Inspiration from kimoonkim/kubernetes-HDFS

kubectl create -f namenode.yaml
kubectl create -f datanode.yaml

Setup a port-forward to so you can see it is alive:

@aclisp
aclisp / svnlist.go
Last active May 29, 2017 09:50
A golang app that list svn dirs...
package main
import (
"encoding/json"
"encoding/xml"
"fmt"
"net/http"
"strings"
)
@aclisp
aclisp / cap.conf
Last active June 14, 2017 12:52
Send alarm for k8s Pods with heapster API.
{
"cap": [
{ "app": "__default", "s2s": "friday_alert", "cpu": 250, "mem": 2147483648 },
{ "app": "music-mobsrv", "s2s": "mobsrv", "cpu": 850, "mem": 2147483648 },
{ "app": "music-entsrv", "s2s": "entsrv", "cpu": 850, "mem": 2147483648 },
{ "app": "music-guild-service", "s2s": "guildservice", "cpu": 850, "mem": 2147483648 },
{ "app": "music-entms", "s2s": "entms", "cpu": 850, "mem": 2147483648 },
{ "app": "docker-registry-web", "s2s": "friday_alert", "cpu": 850, "mem": 2147483648 },
{ "app": "music-mobflwapp", "s2s": "mobFlwApp", "cpu": 1000, "mem": 2147483648 },
package gziphandler
import (
"compress/gzip"
"log"
"net/http"
"strings"
"sync"
)
@aclisp
aclisp / syslog-nb.cpp
Created July 11, 2017 02:10
syslog-nb
/*
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "Need parameters: PROCESS_NAME showpid|showport|showhost|showconn"
exit 1
fi
PROCESS_NAME=$1
ACTION=$2
@aclisp
aclisp / http_streaming.md
Created October 29, 2018 02:32 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@aclisp
aclisp / selenium-youtube.py
Created November 3, 2018 11:32
Youtube Comment Bot using Selenium
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as expect
from selenium.webdriver.common.keys import Keys
import time
from random import randint
def delay(n):