Skip to content

Instantly share code, notes, and snippets.

@srmds
srmds / replace_soh_separator.py
Last active Sep 18, 2020
Replace SOH control character field separator (Hadoop) with semicolon in CSV file
View replace_soh_separator.py
# replace_soh_separator.py
from pathlib import Path
import logging
logger = logging.getLogger(__name__)
if __name__ == "__main__":
"""
@srmds
srmds / locustfile.py
Last active Mar 8, 2019
Load testing API with Locust
View locustfile.py
'''
Simple LocustIO testing script to call an API endpoint
********************************** Installation instructions **************************************
Prerequisites
- python 2.7 / 3
- pip, see: https://pip.pypa.io/en/stable/installing/
- locust, see: https://locust.io
@srmds
srmds / gist:b93d4381c370258e87e50b87f7fd17df
Created Nov 6, 2018
Delete all timemachine localsnapshots
View gist:b93d4381c370258e87e50b87f7fd17df
for date in $(tmutil listlocalsnapshots / | perl -pe 's/com.*(2018.*)/\1/'); do echo "deleting $date"; sudo tmutil deletelocalsnapshots "$date"; done
View Bare Android SDK Setup MacOS.md
@srmds
srmds / TimeFormatter.swift
Created Nov 28, 2016
TimeFormatter Swift 3.0 - Convert milliseconds to a formatted output string of hours:minutes:seconds with applied padding
View TimeFormatter.swift
//
// TimeFormatter.swift
//
// Convert milliseconds to a formatted output string containing hours:minutes:seconds
// with padding zero.
//
// Created by srmds on 28/11/16.
// Copyright © 2015 srmds. All rights reserved.
//
import Foundation
@srmds
srmds / AsyncFetchRequest.swift
Created Oct 2, 2015
Swift 2.0 Asynchronous Fetch Request
View AsyncFetchRequest.swift
func getAllEvents(sortedByDate:Bool = false, sortAscending:Bool = true) -> Array<Event> {
print("getAllEvents")
var fetchedResults:Array<Event> = Array<Event>()
let minionManagedObjectContextWorker:NSManagedObjectContext = NSManagedObjectContext.init(concurrencyType: NSManagedObjectContextConcurrencyType.PrivateQueueConcurrencyType)
minionManagedObjectContextWorker.parentContext = self.mainContextInstance
let fetchRequest = NSFetchRequest()
let entity = NSEntityDescription.entityForName("Event", inManagedObjectContext: minionManagedObjectContextWorker)
@srmds
srmds / DateFormatter.swift
Created Oct 2, 2015
Swift 2.0 DateFormatter - Parse NSDate to a formatted String, Parse String to a formatted NSDate object
View DateFormatter.swift
//
// DateFormatter.swift
// CoreDataCRUD
//
// Created by c0d3r on 01/10/15.
// Copyright © 2015 io pandacode. All rights reserved.
//
import Foundation
@srmds
srmds / TimeFormatter.swift
Last active Mar 2, 2020
TimeFormatter Swift 2.0 - Convert milliseconds to a formatted output string of hours:minutes:seconds with applied padding
View TimeFormatter.swift
//
// TimeFormatter.swift
// ElectroDeluxe-Swift2.0
//
// Convert milliseconds to a formatted output string containing hours:minutes:seconds
// with padding zero.
//
// Created by c0d3r on 21/08/15.
// Copyright © 2015 srmds. All rights reserved.
//
@srmds
srmds / TimeFormatter.h
Last active Sep 4, 2015
Obj-C - Convert milliseconds to a formatted output string of hours:minutes:seconds with applied padding
View TimeFormatter.h
//
// TimeFormatter.h
// ElectroDeluxe
//
// Convert milliseconds to a formatted output string containing hours:minutes:seconds
// with padding zero.
//
// Copyright © 2015 srmds. All rights reserved.
//