Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
I may be slow to respond.

alberto elpsk

:octocat:
I may be slow to respond.
View GitHub Profile
@elpsk
elpsk / xcode_code_lines_counter_script.sh
Created Sep 4, 2020
Count the number of code in Xcode iOS (objectivec/swift) project excluding the Cocoa Pods
View xcode_code_lines_counter_script.sh
#!/bin/sh
### ---------------
### Get the sum of the total line of code for that project folder
### ---------------
find . -path ./Pods -prune -o \( -name "*.h" -o -name "*.m" -o -name "*.swift" \) -print0 ! -name "/Pods" | \
xargs -0 wc -l |\
sort -t '\0' -n -r |\
grep " total" |\
awk '{print $1}'
View BluetoothManager.swift
//
// BluetoothManager.swift
//
import CoreBluetooth
protocol BluetoothManagerDelegate: AnyObject {
func didErrorReceived(manager: NSObject)
func didSensorReceived(data: Data, rssi: Int)
}
View SentimentAnalysis - UIViewController
//
// Twitter SentimentAnalysis
//
import UIKit
import SwifteriOS
import CoreML
class ViewController: UIViewController {
@elpsk
elpsk / CoreML Twitter sentiment analysis
Last active Mar 5, 2020
A sample playground to create a trained model for twitter sentiment analysis
View CoreML Twitter sentiment analysis
import Cocoa
import CreateML
// tha path of your csv file
let baseFolder = "<#path#>"
let data = try! MLDataTable(contentsOf: URL(fileURLWithPath: "\(baseFolder)/twitter-sanders-apple3.csv"))
let (trainingData, testingData) = data.randomSplit(by: 0.8, seed: 5)
// classifier
@elpsk
elpsk / Fastfile
Last active Mar 4, 2020
Gitlab-ci.yml and Fastlane
View Fastfile
# update_fastlane
default_platform(:ios)
platform :ios do
def build_appname( configuration, schema, export_method )
build_app(
workspace: "appname.xcworkspace",
configuration: configuration,
scheme: schema,
View JWT key generate
1- Generating a Private Key:
`openssl genrsa -aes256 -out private_key.pem 2048`
2- Generating a Public Key:
`openssl rsa -pubout -in private_key.pem -out public_key.pem`
View gist:bdf0200f28b94d852e8415f5a344813c
[
@"accelerator",
@"airbag",
@"alarm",
@"alternator",
@"antenna",
@"armrest",
@"auto",
@"automobile",
@"axle",
View gist:64efc677276269d054e8526f9f801822
[
@"accelerator",
@"airbag",
@"alarm",
@"alternator",
@"antenna",
@"armrest",
@"auto",
@"automobile",
@"axle",
@elpsk
elpsk / HotspotHelper.swift
Last active Apr 2, 2020
Connect to Wifi network from code – Swift
View HotspotHelper.swift
//
// HotspotHelper.swift
// Created by Pasca Alberto, IT on 03/11/2019.
// https://www.albertopasca.it/
//
// MORE details on:
// https://www.albertopasca.it/whiletrue/connect-to-wifi-network-from-code-swift/
//
import NetworkExtension
@elpsk
elpsk / NEHotspotConfigurationManager.swift
Created Aug 9, 2019 — forked from kraigspear/NEHotspotConfigurationManager.swift
Connect to a WIFI hotspot programmatically in iOS 11
View NEHotspotConfigurationManager.swift
//
// ViewController.swift
// NetworkTest
//
// Created by Kraig Spear on 10/10/17.
// Copyright © 2017 spearware. All rights reserved.
//
import UIKit
import NetworkExtension
You can’t perform that action at this time.