Skip to content

Instantly share code, notes, and snippets.

import Foundation
protocol OperationType {
var operationType: RequestOperationType { get }
}
public enum RequestOperationType: Int {
case blah
case devices
}
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import h5py
import numpy as np
### Requirement: name, path, embedding
'''
"${PODS_ROOT}/Fabric/run"
# ${CONFIGURATION} usualy Debug and Release.
# You should create referenced folders for each Configuration (Debug and Release folders inside Firebase folder)
# and store GoogleService-Info.plist file
cp "${PROJECT_DIR}/MyApp/Resources/Firebase/${CONFIGURATION}/GoogleService-Info.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist"
###### RENEW SERVER: ####################################
#stop nginx
sudo systemctl stop nginx
#renew
/opt/letsencrypt/certbot-auto renew
#start nginx
sudo systemctl start nginx
##########################################################
@egcode
egcode / Caffe Makefile.config
Last active April 23, 2019 17:15
Ubuntu 16.04 caffe makefile.config for python3.5
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!
# cuDNN acceleration switch (uncomment to build with cuDNN).
# USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
CPU_ONLY := 1
# uncomment to disable IO dependencies and corresponding data layers
@egcode
egcode / push.sh
Last active August 21, 2020 09:19
push notification curl
#!/bin/bash
# to execute it first chmod +x push.sh
deviceToken=<device token id from device did receive token>
authKey="./AuthKey_<auth_key>.p8"
authKeyId=<auth_key>
teamId=<team id>
bundleId=<bundle id>
endpoint=https://api.development.push.apple.com
@egcode
egcode / SertificatePinning.swift
Last active August 10, 2022 17:15
Sertificate Pinning
### GENERATING Ceritificate for XCODE:
### .der file #####
openssl s_client -connect website.com:443 -showcerts < /dev/null | openssl x509 -outform DER > website.com.der
import Security
class NSURLSessionPinningDelegate: NSObject, URLSessionDelegate {
func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Swift.Void) {
@egcode
egcode / MaterialView.swift
Last active March 5, 2019 04:12
Material View
import UIKit
class MaterialView: UIView {
override func awakeFromNib() {
layer.cornerRadius = 2.0
layer.shadowColor = UIColor(red: 157.0 / 255.0, green: 157.0 / 255.0, blue: 157.0 / 255.0, alpha: 0.5).cgColor
layer.shadowOpacity = 0.8
layer.shadowRadius = 5.0
layer.shadowOffset = CGSize(width: 0.0, height: 2.0)
import UIKit
extension UIImageView {
func loadImage(url: String, completed: @escaping (_ success: Bool) -> Void) {
API.get(url: url) { (code, object) in
if let img = object as? UIImage {
self.image = img
completed(true)
} else {
completed(false)
import UIKit
//-------------------------------------------------------------------------------
//MARK: - API
class API {
enum Method:String {
case get = "GET"
case post = "POST"