Skip to content

Instantly share code, notes, and snippets.

View romainbriche's full-sized avatar

Romain Briche romainbriche

View GitHub Profile
@romainbriche
romainbriche / keychaincli.md
Created January 27, 2019 19:37
Storing CLI password in Keychain on Mac OS X

Secure CLI Passwords with Keychain Services on Mac OS X

Creating a Password

Dump a password into keychain. I'm using the creator/kind codes "asbl" for Ansible, but you can use any 4 character code. It's useful for doing lookups later.

$ security add-generic-password -a "root" -c "asbl" -C "asbl" -D "Ansible Vault" -s "ansible secrets" -w "secret123password456"

From man security:

@romainbriche
romainbriche / encrypt_openssl.md
Created July 16, 2018 07:44 — forked from dreikanter/encrypt_openssl.md
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

@romainbriche
romainbriche / StreamReader.swift
Created June 8, 2018 00:27 — forked from sooop/StreamReader.swift
Read a large text file line by line - Swift 3
import Foundation
class StreamReader {
let encoding: String.Encoding
let chunkSize: Int
let fileHandle: FileHandle
var buffer: Data
let delimPattern : Data
var isAtEOF: Bool = false
@romainbriche
romainbriche / batch-download-images.sh
Created June 6, 2018 23:02 — forked from solepixel/batch-download-images.sh
Use wget to batch download a list of image URLs
wget -i image-list.txt --force-directories
@romainbriche
romainbriche / CIFilter+Extension.swift
Created May 29, 2018 11:46 — forked from ha1f/CIFilter+Extension.swift
CIFilter+Extension.swift
//
// Created by はるふ on 2017/12/11.
// Copyright © 2017年 ha1f. All rights reserved.
//
import Foundation
import CoreImage
import AVFoundation
extension CIFilter {
@romainbriche
romainbriche / README.md
Created February 20, 2018 07:19 — forked from acrookston/README.md
Xcode pre-action to build custom Info.plist

Automatic build versions from git in Xcode (and other goodies)

Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.

1. Xcode Scheme pre-action

Edit Xcode Scheme and add a pre-action script. Copy the contents of preaction.sh into the pre-action script box.

@romainbriche
romainbriche / build-environment.py
Created February 20, 2018 06:26
A kinda hacky script to set up iOS env config for RN, Objective-C, and preprocessor defines.
#!/usr/bin/python
from plistlib import readPlist as read_plist
from subprocess import check_output
import socket
import json
from datetime import datetime
import os
# Export your version of these for testing the script from the console directly:
@romainbriche
romainbriche / s3.sh
Created January 7, 2018 19:42 — forked from chrismdp/s3.sh
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@romainbriche
romainbriche / s3get.sh
Created January 7, 2018 19:42 — forked from jpillora/s3get.sh
S3 signed GET in plain bash (Requires openssl and curl)
#!/bin/bash
#set these in your environment/profile (NOT HERE)
AWS_ACCESS_KEY=""
AWS_SECRET_KEY=""
function s3get {
#helper functions
function fail { echo "$1" > /dev/stderr; exit 1; }
#dependency check
@romainbriche
romainbriche / Android Screenshot.bat
Created December 18, 2017 10:29 — forked from leighmcculloch/Android Screenshot.bat
This batch script will take a screenshot on an Android device using ADB, download the screenshot to the directory this script to the current directory and then remove the screenshot file from the device. Screenshots are saved with filename: screenshot-YYYYMMDD-HHMMSS.png. ADB must be connected to a device already.
@echo off
rem configurable parameters
set SCREENCAP_FILE_PREFIX=screenshot
rem the dir on the device where the screenshot will be stored temporarily
set SCREENCAP_WORKING_DIR=/sdcard/
rem adb path, leave blank if adb is already on the user or system path
set SCREENCAP_ADB_PATH=