Skip to content

Instantly share code, notes, and snippets.

View djds23's full-sized avatar

Dean Silfen djds23

View GitHub Profile
find . -name \*.swift | tr '\n' '\0' | xargs -0 SwiftGenStrings -o .
@djds23
djds23 / mov2gif
Created March 1, 2018 18:53
convert mov 2 gif
#/bin/bash
if [[ $2 -eq 0 ]]; then
ffmpeg -ss 00:00:00.000 -i $1 -pix_fmt rgb24 -r 10 output.gif
else
ffmpeg -ss 00:00:00.000 -i $1 -pix_fmt rgb24 -r 10 $2
fi
@djds23
djds23 / LocalisedStrings.swift
Created February 28, 2018 00:30 — forked from douglashill/LocalisedStrings.swift
Generating an enum to ensure only defined localised string keys are used. For development on Apple platforms.
// Douglas Hill, February 2018
import Foundation
/// Returns a localised string with the key as an enum case so the compiler checks it exists.
/// The enum should be automatically generated using UpdateLocalisedStringKeys.swift.
public func localisedString(_ key: LocalisedStringKey) -> String {
return Bundle.main.localizedString(forKey: key.rawValue, value: nil, table: nil)
}
@djds23
djds23 / des.swift
Created February 6, 2018 15:58
Swift - String to JSON example
jsonInStringFormat.data(using: String.Encoding.utf) // -> String -> Data, for use with JSONSerialization
@djds23
djds23 / gist:eeab5ba359b94a71dbb20f857fd04cfb
Created September 30, 2017 18:00 — forked from mobmad/gist:433ba54e9cb97d6d7771
Create self-signed certificate for wiremock and configure a java client under test for HTTPS

1. Generate self-signed certificate

keytool -genkey -alias wiremock -keyalg RSA -keysize 1024 \
    -validity 365 -keypass password -keystore identity.jks -storepass password

Important: keypass must equal storepass, or else you'll receive java.io.IOException: !JsseListener: java.security.UnrecoverableKeyException: Cannot recover key

2. Start wiremock with the new keystore and HTTPS enabled

@djds23
djds23 / led-server.ino
Created July 18, 2017 15:49
WiFi Server with nodeMCU module
#include <Arduino.h>
#include <ESP8266WiFi.h>
/////////////////////////////////
// WiFi Network Name: LED FLIP //
////////////////////////////////
/////////////////////////////
// IP Address: 192.168.4.1 //
////////////////////////////
@djds23
djds23 / led-server.ino
Created July 18, 2017 15:49
WiFi Server with nodeMCU module
#include <Arduino.h>
#include <ESP8266WiFi.h>
/////////////////////////////////
// WiFi Network Name: LED FLIP //
////////////////////////////////
/////////////////////////////
// IP Address: 192.168.4.1 //
////////////////////////////
@djds23
djds23 / toucan.txt
Last active December 1, 2016 17:55
this is a toucan
_ _.-''''''--._
.` `. ...------.\
/ |O :-` _,.,---'
' \ ;--''
| _.' (
,' _,' `-.
: / '.
\ \ '
`.| `.
`-._ \
@djds23
djds23 / react-static-srv.sh
Created July 31, 2016 17:57
React build static file
echo "Pulling branch master"
git pull origin master
echo "Building static site"
node ./scripts/build.js
echo "Moving build to /srv/"
cp -R ./build /srv/
echo "Kicking over NGINX"
@djds23
djds23 / provision.sh
Last active July 31, 2016 15:31
Provision a digital ocean box
apt-get install -y git
apt-get install -y build-essential
# Install node 4.X line
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
apt-get install -y nodejs
# Install RVM
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable