This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sourceDbName = "db1"; | |
const targetDbName = "db2"; | |
const sourceDb = db.getSiblingDB(sourceDbName); | |
const targetDb = db.getSiblingDB(targetDbName); | |
const collections = sourceDb.getCollectionNames(); | |
collections.forEach(function(collectionName) { | |
const indexes = sourceDb[collectionName].getIndexes(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl get po --all-namespaces -o json --field-selector="status.phase!=Running" | jq '.items[] | "kubectl delete po \(.metadata.name) -n \(.metadata.namespace)"' | xargs -n 1 bash -c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: rbac.authorization.k8s.io/v1 | |
metadata: | |
namespace: deis | |
name: deployments-secrets | |
rules: | |
- apiGroups: ["extensions", "apps", ""] | |
resources: ["deployments", "secrets"] | |
verbs: ["get", "list"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: ClusterRole | |
apiVersion: rbac.authorization.k8s.io/v1 | |
metadata: | |
namespace: deis | |
name: list-services | |
rules: | |
- apiGroups: [""] | |
resources: ["services", "endpoints", "pods"] | |
verbs: ["get", "list"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl get po -a --all-namespaces -o json | jq '.items[] | select(.status.reason!=null) | select(.status.reason | contains("Evicted")) | "kubectl delete po \(.metadata.name) -n \(.metadata.namespace)"' | xargs -n 1 bash -c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT id,state,command,time,left(replace(info,'\n','<lf>'),120) | |
FROM information_schema.processlist | |
WHERE command <> 'Sleep' | |
AND info NOT LIKE '%PROCESSLIST%' | |
ORDER BY time DESC LIMIT 50; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```json | |
{ | |
"body": { | |
"key": { | |
"eldest_kid": "0120a9bbf79487f5e63072e8979cad3f91a9e7eb1dcec7ec1fea9d21c17c9472ff040a", | |
"fingerprint": "e41a633d40b4cda56dc0696f15bea5b330610e0b", | |
"host": "keybase.io", | |
"key_id": "15bea5b330610e0b", | |
"kid": "01016eab16f55167ee58a2f6faa48e606c4cf67a6f0941e21dd79c70df1dcc28cd330a", | |
"uid": "acfa70f4b862ea840e7c985931e70319", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find -type d -links 2 -exec mkdir -p "/path/to/backup/{}" \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
echo "license_key: YOUR_LICENSE_KEY" | sudo tee -a /etc/newrelic-infra.yml && \ | |
curl https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg | sudo apt-key add - \ | |
&& sudo apt-get update && sudo apt-get install newrelic-infra -y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pattern=new RegExp("^\%B(\d+)\^(\w+)\/(\w+)\^\d+\?;\d+=(\d\d)(\d\d)\d+$"); | |
var match = pattern.exec(card_data); | |
card_number = match[1]; | |
first_name = match[3]; | |
last_name = match[2]; | |
exp_date = match[5] + "/" + match[4]; |
NewerOlder