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
#!/usr/bin/env python | |
API_KEY = '' | |
DEFAULT_SNAPSHOT_ID = "centos-6-x64" | |
import argparse | |
import sys | |
from dopy.manager import DoManager | |
def get_snapshot(do, snapshot_name): | |
list_snapshots = do.request('/snapshots') |
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
#!/usr/bin/env python | |
API_KEY = '' | |
import argparse | |
import sys | |
from dopy.manager import DoManager | |
if sys.version < '3': | |
integer_types = (int, long,) | |
else: | |
integer_types = (int,) |
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
#!/usr/bin/env python | |
API_KEY = '' | |
import argparse | |
import sys | |
from dopy.manager import DoManager | |
if sys.version < '3': | |
integer_types = (int, long,) | |
else: | |
integer_types = (int,) |
On NUMA 0
#ps -Af|grep '/usr/bin/redis-server'|grep -v grep|grep -E ":6399|:6500|6395"|awk '{print $2}'| xargs -I {} taskset -pc $(cd /sys/devices/system/node/node0/;ls -d cpu[0-9]*|grep -o [0-9]*|sort -n|head -4|tr '\n' ','|sed -e 's:\,$::') {}
On NUMA 1
#ps -Af|grep '/usr/bin/redis-server'|grep -v grep|grep -E ":6397|:6389|:6400|:6500"|awk '{print $2}' | xargs -I {} taskset -pc $(cd /sys/devices/system/node/node1/||cd /sys/devices/system/node/node0/;ls -d cpu[0-9]*|grep -o [0-9]*|sort -n|head -4|tr '\n' ','|sed -e 's:\,$::') {}
need to setup token with
export token=
--header 'From: weldpua2008@com'
while [[ $(echo ${j}|jq ."incidents") != "[]" ]];do
j=$( echo -n '{"incidents":'; curl -X GET --header 'Accept: application/vnd.pagerduty+json;version=2' --header "Authorization: Token token=${token}" 'https://api.pagerduty.com/incidents?statuses%5B%5D=triggered&time_zone=UTC&sort_by=created_at' | jq -c '.incidents|.[]|{ id: ."id", "type": "incident_reference", "status": "resolved"} '| jq --slurp '.';echo -n '}' )
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'From: weldpua2008@com' --header "Authorization: Token token=${token}" -d "$j" "https://api.pagerduty.com/incidents"
sleep 1
done
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
for u in '';do | |
n=$(echo $u|cut -d '?' -f 1) | |
while [ ${#n} -gt 0 ] && [[ $(echo $n| awk -F'/' '{print NF-1}') -gt 0 ]];do | |
n=$(echo $n|sed 's/^[^/]*\///g'); | |
if [[ -e "/etc/nginx/${n}" ]];then | |
echo "curl ${u} > /etc/nginx/${n}" | |
curl ${u} > /etc/nginx/${n} | |
break | |
fi | |
done |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Example script to query LW API v1.0 | |
import requests | |
import json | |
apiurl = 'https://api.leaseweb.com/v1/bareMetals' | |
apikey = '*****' | |
headers = {"X-Lsw-Auth": apikey} | |
results = [] |