Skip to content

Instantly share code, notes, and snippets.

@dneprDroid
dneprDroid / Podfile
Created February 20, 2020 10:33
POD static_framework_transitive_dependencies
..........
$static_framework = ['<SOME_POD_NAME>']
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if $static_framework.include?(pod.name)
def pod.build_type;
Pod::Target::BuildType.static_library
@dneprDroid
dneprDroid / GIT TOKEN
Created January 16, 2020 20:50
GIT TOKEN
git config --global credential.helper store && git fetch --all && cat ~/.git-credentials
@dneprDroid
dneprDroid / show-ports
Created January 15, 2020 20:04
show ports in USE
sudo lsof -i -P -n | grep LISTEN
@dneprDroid
dneprDroid / saveBytesToFile.js
Created January 14, 2020 22:05
Save text file JS
var sampleBytes = new Int8Array(4096*1000*100);
var saveByteArray = (function () {
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
return function (data, name) {
var blob = new Blob(data, {type: "octet/stream"}),
url = window.URL.createObjectURL(blob);
console.log("Blob URL: ", url);
;// store 3822
mov x8, #3822
;// next: (4969 << 16) | 3822
movk x8, #4969, lsl #16 ;// now `x8` is 325652206
;// next: (2 << 32) | ((4969 << 16) | 3822)
movk x8, #2, lsl #32 ;// now `x8` is 8915586798
@dneprDroid
dneprDroid / derivative.py
Created October 16, 2019 07:33
derivative
import numpy as np
import matplotlib.pyplot as plt
def func1(x):
return np.sin(x)
def func1der(x):
return np.cos(x)
import tfcoreml as tf_converter
tf_converter.convert(tf_model_path='my_model.pb',
mlmodel_path='my_model.mlmodel',
input_name_shape_dict=input_tensor_shapes,
output_feature_names=output_tensor_names)
import coremltools
your_model = coremltools.converters.keras.convert('your_model.h5',
input_names=['image'],
output_names=['output'],
image_input_names='image')
your_model.save('your_model_name.mlmodel')
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import re
import time
from functools import reduce
import pyperclip
gcloud ai-platform jobs submit training ${job_name} --job-dir ${job_dir} \
--python-version 3.5 \
--runtime-version 1.9 \
--package-path ./trainer `# trainer module ` \
--module-name trainer.train `# file train.py from trainer module` \
--region ${region} \
--scale-tier BASIC_GPU `# single NVIDIA Tesla K80 GPU` \
-- `# Next, the params for train.py` \
--weights_stage "${job_dir}/weights_stage_exported_tiny.h5" `# exported stage pre-trained model ` \
--weights_final "${job_dir}/weights_final_exported_tiny.h5"" `# exported final pre-trained model ` \