Skip to content

Instantly share code, notes, and snippets.

View ajmaradiaga's full-sized avatar

Antonio Maradiaga ajmaradiaga

View GitHub Profile
@ajmaradiaga
ajmaradiaga / extract-svg-from-drawio-library.py
Last active January 28, 2024 07:08
The Python script process the Draw.io library files and "extract" the images from within it. In my case, I want to save the images as SVG and PNG files.
import base64
import json
import xml.etree.ElementTree as ET
import os
import cairosvg
process_files = [
'Library-1.drawio',
'Library-2.drawio'
@ajmaradiaga
ajmaradiaga / process-postman-files.sh
Last active September 29, 2023 07:41
Process Postman export files
#!/bin/bash
##############
# The zip file provided by Postman of a full export will include two folders, environment and collections.
# Within these folder there will be many files with guids as filenames. Making it non-user friendly
# to know the file of a specific environment/collection.
#
# The simple script below will rename the files by extracting the name within the contents of the file.
##############
@ajmaradiaga
ajmaradiaga / gradient_descent.py
Created March 30, 2017 09:29
Gradient Descent implemented in Python using numpy
import numpy as np
def gradient_descent_runner(points, starting_m, starting_b, learning_rate, num_iterations):
m = starting_m
b = starting_b
for i in range(num_iterations):
m, b = step_gradient(m, b, np.array(points), learning_rate)
return m, b
@ajmaradiaga
ajmaradiaga / gist:943582
Created April 27, 2011 01:49
Instance a NSManagedObject without inserting in ManagedObjectContext
//Assuming Accounts = Name of the Entity to instance
BlipAppDelegate *_appDelegate = (BlipAppDelegate *)[[UIApplication sharedApplication] delegate];
NSManagedObjectContext *MOC = [_appDelegate managedObjectContext];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Accounts" inManagedObjectContext:MOC];
Accounts *account = (Accounts *)[[NSManagedObject alloc] initWithEntity:entity insertIntoManagedObjectContext:nil];
//Insert data to account
@ajmaradiaga
ajmaradiaga / BluetoothRestart
Created April 27, 2011 00:16
Force Bluetooth Restart on Mac
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist