Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am anakin-hao on github.
  • I am akua28 (https://keybase.io/akua28) on keybase.
  • I have a public key ASAbwDF51V85JV2RsTplvgAn-FaAUXBMVrgcSetctLOhUQo

To claim this, I am signing this object:

SELECT puff_id, timestamp, ST_X(location::geometry) AS lon, ST_Y(location::geometry) AS lat, lte, lmr from location
where realm_id = 'tait-internal-trial' AND puff_id = 'dc1a7f60-5047-48d7-8fb4-a1fe06044b3a'
AND timestamp between 1566435600000 and 1566450000000;
@Anakin-Hao
Anakin-Hao / test_infinispan_failover.py
Created May 15, 2019 05:31
test infinispan failover
import requests
from requests.auth import HTTPBasicAuth
import time
headers = {'Content-Type': 'application/json', 'performAsync': 'True', 'timeToLiveSeconds': '99999999999'}
body = {'test':123}
auth=HTTPBasicAuth('test', 'changeme')
baseurl = "http://infinispan-server-http/rest"
# baseurl = "http://infinispan-server-http.anakin-dev.svc.cluster.local/rest"
@Anakin-Hao
Anakin-Hao / infinispan_cluster_nodes_count.sh
Created May 10, 2019 04:26
Check infinispan cluster nodes count
kubectl exec -it infinispan-server-0 -- /opt/jboss/infinispan-server/bin/ispn-cli.sh --connect "/subsystem=datagrid-infinispan/cache-container=clustered:read-attri
bute(name=cluster-size)"
@Anakin-Hao
Anakin-Hao / test.py
Created May 9, 2019 02:11
ignite test
from pyignite import Client
from pyignite.datatypes.cache_config import CacheMode
from pyignite.datatypes.prop_codes import *
from pyignite.exceptions import SocketError
import time
nodes = [('100.108.0.16',10800)]
nodes = [('100.108.0.2', 10800), ('100.108.0.5',10800), ('100.108.0.6',10800)]
@Anakin-Hao
Anakin-Hao / infinispan_test.py
Last active May 9, 2019 02:35
Test infinispan
import requests
from requests.auth import HTTPBasicAuth
import time
headers = {'Content-Type': 'application/json', 'performAsync': 'True', 'timeToLiveSeconds': '99999999999'}
body = {'test':123}
auth=HTTPBasicAuth('test', 'changeme')
baseurl = "http://infinispan-server-http/rest"
import requests
from requests.auth import HTTPBasicAuth
import time
headers = {'Content-Type': 'application/json', 'performAsync': 'True', 'timeToLiveSeconds': '99999999999'}
body = {'test':123}
auth=HTTPBasicAuth('test', 'changeme')
baseurl = "http://infinispan-server-http/rest"
@Anakin-Hao
Anakin-Hao / gist:4a716d1643a9f29b7bb6eaa4f82f883a
Created March 25, 2019 01:41
Build all albi containers in a fodler and push
Get-ChildItem .\containers\api\ -Filter albi_*_rest | Foreach-Object {
$name = $_.BaseName
ECHO $name
$short = $name.replace("albi_", "")
$tag = "$short" + ":latest"
ECHO $short
docker build -t 440617634381.dkr.ecr.ap-southeast-2.amazonaws.com/albi/$tag .\\containers\\api\\ -f .\\containers\\api\\$name\\Dockerfile --no-cache
docker push 440617634381.dkr.ecr.ap-southeast-2.amazonaws.com/albi/$tag
kubectl delete pods -l app=$short}
BEGIN;
ALTER TABLE albi_puff drop constraint albi_puff_realm_id_fkey;
ALTER TABLE albi_puff add constraint albi_puff_realm_id_fkey
FOREIGN KEY (realm_id)
REFERENCES realm(id)
ON DELETE CASCADE;
COMMIT;
@Anakin-Hao
Anakin-Hao / gist:eb09f9ea2a028a4a2e5c140bc81f8c71
Last active January 8, 2019 02:19
NGINX Extract DN from pem cert
map $ssl_client_s_dn $ssl_client_s_dn_cn {
default "";
~CN=(?<CN>[^\/,]+) $CN;
}
map $ssl_client_s_dn $ssl_client_s_dn_o {
default "";
~O=(?<O>[^\/,]+) $O;
}