Skip to content

Instantly share code, notes, and snippets.

View playerjamesbattleground's full-sized avatar

james jiang playerjamesbattleground

View GitHub Profile
@ruanbekker
ruanbekker / promtail_docker_logs.md
Last active September 30, 2024 12:35
Docker Container Logging using Promtail
rgname={your-resource-group-name}
servicebus_uri={namespace-name}.servicebus.windows.net/{queue-name}
shared_access_key_name={your-shared-access-key-name}
shared_access_key={your-shared-access-key}
EXPIRY=${EXPIRY:=$((60 * 60 * 24))}
ENCODED_URI=$(echo -n $servicebus_uri | jq -s -R -r @uri)
TTL=$(($(date +%s) + $EXPIRY))
UTF8_SIGNATURE=$(printf "%s\n%s" $ENCODED_URI $TTL | iconv -t utf8)
@tomdalling
tomdalling / simple_authentication.rb
Created May 23, 2016 12:26
A simple Sinatra app that demonstrates basic authentication
#!/user/bin/env ruby
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'sinatra', '~> 1.4'
gem 'bcrypt', '~> 3.1'
end
require 'sinatra/base'
@QuantumGhost
QuantumGhost / example.puml
Last active September 21, 2024 19:19
A simple template for PlantUML to draw ER diagram.The basic idea comes from http://plantuml.sourceforge.net/qa/?qa=331/database-modeling
@startuml
' uncomment the line below if you're using computer with a retina display
' skinparam dpi 300
!define Table(name,desc) class name as "desc" << (T,#FFAAAA) >>
' we use bold for primary key
' green color for unique
' and underscore for not_null
!define primary_key(x) <b>x</b>
!define unique(x) <color:green>x</color>
!define not_null(x) <u>x</u>
@rmtsrc
rmtsrc / postgres-json-cheatsheet.md
Last active June 7, 2024 05:21
Using JSON in Postgres by example

PostgreSQL JSON Cheatsheet

Using JSON in Postgres by example.

Quick setup via Docker

  1. Download and install: Docker Toolbox
  2. Open Docker Quickstart Terminal
  3. Start a new postgres container:
    docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
@rafaeltuelho
rafaeltuelho / jolokia-jmx-http-reqs.md
Created February 3, 2016 17:02
Jolokia JMX samples http requests
	http://10.10.57.62:8080/jolokia/list
	http://10.10.57.62:8080/jolokia/search/org.hornetq:module=JMS,type=Queue,name=*

	http://10.10.57.62:8080/jolokia/read/java.lang:type=Memory/HeapMemoryUsage
	http://10.10.57.62:8080/jolokia/read/org.hornetq:module=JMS,type=Queue,name=%22MyQueue%22/MessageCount
	http://10.10.57.63:8080/jolokia/read/org.hornetq:module=JMS,type=Queue,name=%22MyQueue%22/DeliveringCount
@pfmiles
pfmiles / pom-ant-run.xml
Last active July 24, 2021 04:22
groovy与java混编的jar工程的maven pom.xml配置
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.pfmiles</groupId>
<artifactId>jar.groovy</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>jar.groovy</name>
@karmi
karmi / .gitignore
Last active September 7, 2024 20:44
Example Nginx configurations for Elasticsearch (https://www.elastic.co/blog/playing-http-tricks-nginx)
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@abrudtkuhl
abrudtkuhl / nginx-elasticsearch-proxy.conf
Last active August 23, 2019 01:33 — forked from karmi/nginx-elasticsearch-proxy.conf
NGINX Reverse Proxy Authentication For Elasticsearch
# Run me with:
#
# $ nginx -p /path/to/this/file/ -c nginx.conf
#
# All requests are then routed to authenticated user's index, so
#
# GET http://user:password@localhost/_search?q=*
#
# is rewritten to:
#