Skip to content

Instantly share code, notes, and snippets.

seanlilmateus / gist:35b5a3df05d0e9e4f0a870a769e88571
Created May 7, 2021 — forked from SFEley/gist:1054553
list all available cucumber steps - (rake cucumber:steps)
View gist:35b5a3df05d0e9e4f0a870a769e88571
# From
# In turn based on
desc "List all available steps"
task :steps do
require 'hirb'
extend Hirb::Console
features_dir = "features"
step_candidates = Dir.glob(File.join(features_dir,'**/*.rb'))
# Follow all the gem requires, and identify which files have steps in them
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
View DataCrypto.swift
protocol Randomizer {
static func randomIv() -> Data
static func randomSalt() -> Data
static func randomData(length: Int) -> Data
protocol Crypter {
func encrypt(_ digest: Data) throws -> Data
func decrypt(_ encrypted: Data) throws -> Data
View advanced-swiftui-animations.swift
// The SwiftUI Lab: Advanced SwiftUI Animations
// (Animating Paths)
// (GeometryEffect)
// (AnimatableModifier)
import SwiftUI
struct ContentView: View {
seanlilmateus / Asymmetric.swift
Created Dec 21, 2020 — forked from dhoerl/Asymmetric.swift
Implement asymmetric cryptography for distributed app where keys can both be stored as strings
View Asymmetric.swift
// Asymmetric.swift
// Created by David Hoerl on 12/23/18.
// Copyright © 2018 David Hoerl. All rights reserved.
This is the portion you need in the distributed app, which uses the public key that can appear in plain text
seanlilmateus / RSAEncryptor.swift
Created Dec 21, 2020 — forked from akhtarraza/RSAEncryptor.swift
RSA Key-Pair generator with Encryption/Decryption support
View RSAEncryptor.swift
import SwiftyRSA
class RSAKeyEncoding: NSObject {
// ASN.1 identifiers
private let kASNBitStringIdentifier: UInt8 = 0x03
private let kASNSequenceIdentifier: UInt8 = 0x30
View cryptocode.swift
func getPublicKey64() -> String? {
var error: UnsafeMutablePointer<Unmanaged<CFError>?>?
let publicK = SecKeyCopyExternalRepresentation(self.publicKey!, error) as Data?
let exportedPublicK = publicK?.base64EncodedString()
print("exported PublicK ",exportedPublicK!)
return exportedPublicK! as String
func getPrivateKey64() -> String? {
var error: UnsafeMutablePointer<Unmanaged<CFError>?>?
let privateK = SecKeyCopyExternalRepresentation(self.privateKey!, error) as Data?
seanlilmateus / RSAEncryption.swift
Created Dec 19, 2020 — forked from pogist/RSAEncryption.swift
Example of RSA encryption on iOS 10+
View RSAEncryption.swift
import Foundation
import Security
struct RSAEncryption {
var publicKey: SecKey!
init(publicKeyString: String) throws {
self.publicKey = try makePublicKey(from: publicKeyString)
seanlilmateus / CryptoBridge.swift
Created Dec 19, 2020 — forked from dfpalomar/CryptoBridge.swift
Wrapper around swift framework to make it compatible with Kotlin MPP projects
View CryptoBridge.swift
@objc public class CryptoBridge: NSObject {
@objc public func generateKeyPair() -> BKeyPair {
let keyPair = RSA.generateKeyPair(keySize: RSA.KeySize.RSA2048)
return BKeyPair(
privateKey: (keyPair?.privateKey.dataRepresentation())!,
publicKey: (keyPair?.publicKey.dataRepresentation())!
seanlilmateus / aprompt.png
Created Dec 17, 2020 — forked from mislav/aprompt.png
My zsh prompt. No oh-my-zsh needed