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 / ArduinoBluetoothHelper.swift
Created Apr 14, 2021
Swift bluetooth communication helper for the SH-HC-08 board
View ArduinoBluetoothHelper.swift
//
// BluetoothHelper.swift
//
// Created by Alberto Pasca on 03/05/17.
// Copyright © 2017 albertopasca.it. All rights reserved.
//
import UIKit
import CoreBluetooth
@elpsk
elpsk / git-update-all.sh
Created Mar 31, 2021
Update all local git projects and clean unused remotes
View git-update-all.sh
#!/bin/bash
# Update all git directories below current directory or specified directory
# Skips directories that contain a file called .ignore
RED="\033[1;31m"
HIGHLIGHT="\033[1;32m"
NORMAL='\033[0m'
function update {
@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",