Skip to content

Instantly share code, notes, and snippets.

View relwell's full-sized avatar
😎
keeping it 💯

Robert Elwell relwell

😎
keeping it 💯
View GitHub Profile
@relwell
relwell / recover_solrcloud_replicas.py
Created July 24, 2016 21:04
Recover SolrCloud Replicas
# This will restore replicas back to a node that has lost all of its data,
# running from the same hostname as the previous node
import sys
from solrcloudpy import SolrConnection
connection = SolrConnection(sys.argv[0], version='6.0.0')
health = connection.cluster_health
if health and health['status'] == 'NOT OK':
for detail in health['details']:
2.1.5 :023 > a
=> {:test=>"one two three", :foo=>456262, :nested=>{:is=>"pretty hard with csvs, and regular expressions"}}
2.1.5 :024 > a.to_json
=> "{\"test\":\"one two three\",\"foo\":456262,\"nested\":{\"is\":\"pretty hard with csvs, and regular expressions\"}}"
2.1.5 :025 > b = Base64.encode64(a.to_json)
Base64.encode64
2.1.5 :025 > b = Base64.encode64(a.to_json)
=> "eyJ0ZXN0Ijoib25lIHR3byB0aHJlZSIsImZvbyI6NDU2MjYyLCJuZXN0ZWQi\nOnsiaXMiOiJwcmV0dHkgaGFyZCB3aXRoIGNzdnMsIGFuZCByZWd1bGFyIGV4\ncHJlc3Npb25zIn19\n"
2.1.5 :026 > Base64.decode64(b)
=> "{\"test\":\"one two three\",\"foo\":456262,\"nested\":{\"is\":\"pretty hard with csvs, and regular expressions\"}}"
1147425-C02RC34ZG8WP:~ robertelwell$ aws codebuild create-project --name sky-watch-custom-policies-build --description "Build for custom policies" --source="type=S3,location=uai2002311-skywatch-pipeline-test/sky-watch-custom-policies-master.zip" --environment="type=LINUX_CONTAINER,image=aws/codebuild/nodejs:6.3.1,computeType=BUILD_GENERAL1_SMALL,privilegedMode=false" --service-role=arn:aws:iam::930136447543:role/app/uai2002311-codebuild-svc --timeout-in-minutes=15 --artifacts="type=NO_ARTIFACTS" --region=us-east-1 --no-verify-ssl
/usr/local/lib/python2.7/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
{
"project": {
"name": "sky-watch-custom-policies-build",
"serviceRole": "arn:aws:iam::930136447543:role/app/uai2002311-codebuild-svc",
"created": 1
# this error is new...
1147425-C02RC34ZG8WP:sky-watch-ui-2 robertelwell$ cagor
Attempting to use cached file after error downloading (https://github.build.ge.com/raw/SECC/cago-config/master/cago-power.yaml): bad content length
# this was just working!
1147425-C02RC34ZG8WP:sky-watch-ui-2 robertelwell$ aws s3 sync build s3://uai2002311-skywatch --no-verify-ssl
/usr/local/lib/python2.7/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
fatal error: An error occurred (AuthorizationHeaderMalformed) when calling the ListObjects operation: The authorization header is malformed; the Credential is mal-formed; expecting "<YOUR-AKID>/YYYYMMDD/REGION/SERVICE/aws4_request".
##################################
# via git+https://
##################################
git clone https://${HARDCODED_ACCESS_TOKEN}:x-oauth-basic@github.build.ge.com/212595461/private_test.git
##################################
# Retrieving a single raw file
##################################
curl --header 'Authorization: token ${HARDCODED_ACCESS_TOKEN}’ --header 'Accept: application/vnd.github.v3.raw' --location 'https://github.build.ge.com/raw/212595461/private_test/master/README.md'
@relwell
relwell / gist:8b334a9b0839575c3f083314940d6e27
Created December 12, 2017 15:37
install hubbard via brew locally
# from anywhere
git clone https://github.build.ge.com/SECC/homebrew-secc.git
brew install --build-from-source --HEAD ./homebrew-secc/hubbard.rb
skywatch=> select policies.key, policies.guid, policies.created_at, count(statuses.id) from policies left join statuses on policies.guid = statuses.policy_guid AND policies.created_at > '2017-12-11' group by policies.key, policies.guid, policies.created_at having policies.created_at > '2017-12-11';
key | guid | created_at | count
---------+--------------------------------------+----------------------------+-------
S3-090 | 804da0e9-78f5-4ee3-8b25-95350a2a049d | 2017-12-13 19:56:15.431+00 | 0
EC2-060 | c45f1eca-7299-44cd-869a-d464c532de41 | 2017-12-13 20:15:49.868+00 | 0
RDS-040 | 3768e28e-505a-4132-9ee3-8d12a6abe36b | 2017-12-13 20:15:50.105+00 | 0
RDS-180 | 4ebdace2-ee6d-4148-86d8-8de02898877a | 2017-12-12 20:27:50.595+00 | 0
EBS-020 | 55c02f96-b7b7-4c0a-ac56-e308f77190bf | 2017-12-13 20:15:49.919+00 | 0
RDS-160 | 17736529-1db1-48d6-b1a6-503d060d7c43 | 2017-12-13 16:06:52.817+00 | 0
RDS-170 | 7e59c92d-7806-4c28-bd8d-441427b
aws lambda add-permission --function-name uai2002311-skywatch-datasources_aws-corporate-config --statement-id uai2002311-skywatch-config-invoke --action 'lambda:InvokeFunction' --principal sns.amazonaws.com --source-arn arn:aws:sns:us-east-1:930136447543:sky-watch-config-trigger
An error occurred (ResourceConflictException) when calling the AddPermission operation: The statement id (uai2002311-skywatch-config-invoke) provided already exists. Please provide a new statement id, or remove the existing statement.
{
"errorMessage": "Could not parse SNS message JSON: [object Object]",
"errorType": "Error",
"stackTrace": [
"/var/task/index.js:29:17",
"Array.map (native)",
"/var/task/index.js:21:50",
"next (native)",
"step (/var/task/index.js:100:202)",
"/var/task/index.js:100:459",
DEFAULT_INTERVAL = 5000; //ms
class MyComponent extends React.Component {
state = {
interval: DEFAULT_INTERVAL
timeoutId = setTimeout(DEFAULT_INTERVAL, someApiFunction),
};
constructor(props) {
super(props);
this.onIntervalChange = this.onIntervalChange.bind(this);