Skip to content

Instantly share code, notes, and snippets.

@jalakoo
jalakoo / QRManager.swift
Last active July 6, 2018 16:32
Manager Class for handling QR Scanning
// Requirements: info.plist: 'Privacy - Camera Usage Description'
import UIKit
import AVFoundation
import QRCodeReader //pod 'QRCodeReader.swift', '~> 8.2.0'
typealias QRManagerErrorBlock = (_ error: Error)->()
typealias QRManagerResultBlock = (_ valueScanned: String)->()
enum QRManagerError : Error {
@jalakoo
jalakoo / String+Localization.swift
Last active August 31, 2018 16:59
Simple localization category for Swift strings
import Foundation
extension String {
// Example usage: "My Text".localized()
func localized() -> String {
return Bundle.main.localizedString(forKey: self,
value: nil,
table: nil)
}
@jalakoo
jalakoo / reload.sh
Last active October 4, 2019 19:42
Simple alwaysAI redploy script
#!/bin/bash
# To make this file executable from the command line, enter: `chmod +x reload.sh`
aai app exec sudo killall python -9 --no-container
aai app deploy --yes
aai app start
@jalakoo
jalakoo / ubuntu+aai.sh
Last active October 16, 2019 04:25
Ubuntu + alwaysAI supporting setup
#!/bin/bash
# In ubuntu / ubuntu VM
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get update && sudo apt-get install nodejs -y
sudo apt-get install npm -y
sudo apt-get remove docker docker-engine docker.io -y
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@jalakoo
jalakoo / alwaysai_deploy_to_balena.sh
Last active May 19, 2020 23:23
Convenience Bash script for deploying alwaysAI apps to Balena
#!/bin/bash
############
# Simple script for preparing and deploying an alwaysAI app to Balena
# app_name arg should match the name of the application created in Balena
# To make this script runnable: run `chmod +x _name_of_this_script_.sh` in your command line
# NOTE: The entire app should exist in it's own repo.
############
# Extract app name from arg if present
@jalakoo
jalakoo / alwaysai_create_standalone.sh
Last active May 19, 2020 23:25
Bash script for quickly creating a standalone alwaysai docker image
#!/bin/bash
# If this file is in your project root dir `aai app deploy`
# will copy this to the target device app root directory.
# Then either run this on the target deployment device
# with ./build_standalone.sh by direct ssh or by using
# `aai app shell --no-container` from your dev machine.
# Additional information at https://dashboard.alwaysai.co/docs/application_development/packaging_app_as_docker_image.html
echo 'Image name for standalone file? (no spaces)'
read image_name
@jalakoo
jalakoo / assign_static_ip.sh
Last active June 3, 2020 18:13
NMCLI Static IP address setup
#!/bin/bash
echo 'Name of connection to make static (select from "nmcli conn show"):'
read CONN_NAME
echo $CONN_NAME
echo
echo 'IP Address to assign:'
read IP_ADDRESS
echo IP_ADDRESS
@jalakoo
jalakoo / hot-reload.sh
Last active August 3, 2020 18:22
Simple nodemon script that allows for deploy & start upon file save.
#!/bin/bash
# To make this file executable from the command line, enter: `chmod +x hot-reload.sh`
nodemon -x "./reload.sh" --ext py
@jalakoo
jalakoo / index.js
Created October 21, 2020 20:30
Sendbird Getting Started UIKit JS - Start
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
const rootElement = document.getElementById("root");
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
@jalakoo
jalakoo / App.js
Last active October 21, 2020 20:30
Sendbird Getting Started UIKit JS - Start
import React from "react";
import "./styles.css";
export default function App() {
return (
<div className="App">
<h1>Hello CodeSandbox</h1>
<h2>Start editing to see some magic happen!</h2>
</div>
);