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 / 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 / pynamo_model_serialize_json.py
Created March 7, 2018 02:31
PynamoDB serialize models to json
from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute, ListAttribute, MapAttribute
import os
import json
class BaseModel(Model):
def to_dict(self):
rval = {}
for key in self.attribute_values:
@toshke
toshke / s3copy.py
Created February 16, 2018 02:49
copy from s3 to s3
import boto3
import os
import zipfile
import glob
import logging
import shutil
logger = logging.getLogger()
logger.setLevel(logging.INFO)

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 / 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
@toshke
toshke / dynamodb_copy_table_items
Last active January 31, 2024 19:27
Copy DynamoDB table items from one table to other
#!/usr/bin/env python
import boto3
import sys
####
#### usage copy_dynamo_items.py <srcTable> <dstTable> [dstTableRegion] [dstTableProfile]
#### source table region will get picked up from environment variables
#### if target table region is different than source region, pass it as 3rd argument to script
#### source table credentials are picked up from environment
#### if target table credentials are different from source, pass it as 4rd argument to the script as local profile name
@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 / clean-dynamo-table
Last active June 15, 2023 13:08 — forked from k3karthic/truncate_dynamodb.sh
Truncate all keys in a dynamodb table
#!/bin/bash
####
#### Delete (remove) all items from Aws Dynamo DB table, by specifing table name and primary key
####
#### Forked from https://gist.github.com/k3karthic/4bc929885eef40dbe010
####
#### Usage:
#### clean-dynamo-table TABLE_NAME PRIMARY_KEY
####