Skip to content

Instantly share code, notes, and snippets.

View toshke's full-sized avatar

Nikola Tosic toshke

  • Buffer Overflow
  • Melbourne, Australia
  • X @thetoske
View GitHub Profile
@toshke
toshke / gist:defb7da559515bdf290ecb0484dbe5b9
Created May 12, 2017 00:16
Develoeprs Global Gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.d
​*.d.*​
*.o
*.a
@toshke
toshke / gist:c22e5b924f061cb067ae895accb0da32
Created September 22, 2017 05:15
jenkins declarative pipeline in place sort
@NonCPS
def nonCpsTest() {
def list = [
['CreationDate': '200'],
['CreationDate': '300'],
['CreationDate': '100'],
]
def rval = list.sort true, { it['CreationDate'] }
@toshke
toshke / truncate_dynamodb.sh
Created September 28, 2017 00:15 — forked from k3karthic/truncate_dynamodb.sh
Truncate all keys in a dynamodb table
#!/bin/bash
TABLE_NAME=$1
# Get id list
aws dynamodb scan --table-name $TABLE_NAME | grep ID | awk '{ print $2 }' > /tmp/truncate.list
# Delete from id list
cat /tmp/truncate.list | xargs -IID aws dynamodb delete-item --table-name $TABLE_NAME --key '{ "id": { "S": "ID" }}'
@toshke
toshke / truncate_dynamodb.sh
Created September 28, 2017 00:15 — forked from k3karthic/truncate_dynamodb.sh
Truncate all keys in a dynamodb table
#!/bin/bash
TABLE_NAME=$1
# Get id list
aws dynamodb scan --table-name $TABLE_NAME | grep ID | awk '{ print $2 }' > /tmp/truncate.list
# Delete from id list
cat /tmp/truncate.list | xargs -IID aws dynamodb delete-item --table-name $TABLE_NAME --key '{ "id": { "S": "ID" }}'
@toshke
toshke / truncate_dynamodb.sh
Created September 28, 2017 00:15 — forked from k3karthic/truncate_dynamodb.sh
Truncate all keys in a dynamodb table
#!/bin/bash
TABLE_NAME=$1
# Get id list
aws dynamodb scan --table-name $TABLE_NAME | grep ID | awk '{ print $2 }' > /tmp/truncate.list
# Delete from id list
cat /tmp/truncate.list | xargs -IID aws dynamodb delete-item --table-name $TABLE_NAME --key '{ "id": { "S": "ID" }}'
@toshke
toshke / pypi-release-checklist.md
Created November 13, 2017 23:22 — forked from audreyfeldroy/pypi-release-checklist.md
My PyPI Release Checklist
  • Update HISTORY.rst
  • Commit the changes:
git add HISTORY.rst
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@toshke
toshke / clearJenkinsQueue.groovy
Created April 10, 2018 22:54
Clear Jenkins Queue
import hudson.model.*
def queue = Hudson.instance.queue
println "Queue contains ${queue.items.length} items"
queue.clear()
println "Queue cleared"
@toshke
toshke / sns2slack.py
Created May 29, 2018 06:19
AWS Lambda SNS to Slack Message
import json
import base64
import sys
import os
def lambda_handler(event, context):
url = os.environ['slack_incoming_hook']
headers = {
@toshke
toshke / copy_aws_ssm_parameters.py
Created July 2, 2018 01:56
Copy AWS System Manager Parameters from one path to another path
import boto3;
client = boto3.client('ssm')
src_path = '/source/ssm/path'
dst_path = '/destination/ssm/path'
ssm_key_id = '<<keyidhere>>'
def printparams(params):
for p in params['Parameters']:
new_path = p['Name'].replace(src_path, dst_path)