This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Product { | |
//... | |
images: [String] //could be undefined | |
} | |
*/ | |
db.getCollection('products').find().forEach(function (doc) { | |
if (doc.images !== undefined) { | |
for(var i = 0; i < doc.images.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dcs = docker-cloud service, see https://github.com/lifeisfoo/docker-cloud-aliases | |
dcs create -n service-name -t 1 image-name:tag | |
dcs start service-name # or UUID | |
dcs env ls b239 # show environment variables for a service | |
dcs set --link-service mongo:mongo b239 # link another service to this | |
dcs env add -e DATABASE_HOST=mongo b239 # add a variable to the env | |
dcs env add -e DATABASE_PORT=27017 b239 # add another variable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM openjdk:8u92-jre-alpine | |
RUN apk add --update --no-cache \ | |
curl libgcc libstdc++ libx11 glib libxrender libxext libintl ttf-liberation | |
RUN curl -O http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz | |
RUN tar -xvJ -f wkhtmltox-0.12.3_linux-generic-amd64.tar.xz wkhtmltox/bin/wkhtmltopdf | |
RUN mv wkhtmltox/bin/wkhtmltopdf /usr/bin | |
RUN rm -rf wkhtmltox | |
RUN rm wkhtmltox-0.12.3_linux-generic-amd64.tar.xz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* http://www.groovy-lang.org/download.html | |
* https://www.mongodb.com/download-center?jmp=nav#community | |
* https://ratpack.io/manual/current/all.html | |
* http://gorm.grails.org/latest/mongodb/manual/ | |
*/ | |
@Grapes([ | |
@Grab('io.ratpack:ratpack-groovy:1.4.4'), | |
@Grab('org.slf4j:slf4j-simple:1.7.21'), | |
@Grab('org.grails:grails-datastore-gorm-mongodb:6.0.3.RELEASE'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Security | |
class NSURLSessionPinningDelegate: NSObject, NSURLSessionDelegate { | |
func URLSession(session: NSURLSession, didReceiveChallenge challenge: NSURLAuthenticationChallenge, completionHandler: (NSURLSessionAuthChallengeDisposition, NSURLCredential?) -> Void) { | |
// Adapted from OWASP https://www.owasp.org/index.php/Certificate_and_Public_Key_Pinning#iOS | |
if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mkdir git-bisect-test | |
cd git-bisect-test | |
git init | |
echo "#!bin/sh\n" > script.sh | |
echo "exit 0" >> script.sh | |
git add script.sh | |
git commit -a -m "initial commit" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Swift CNPPopupController ViewController Example | |
// See https://github.com/carsonperrotti/CNPPopupController | |
// | |
// Created by Alessandro Miliucci on 7 Jan 2016. | |
// [email protected] | |
// | |
import UIKit | |
import CNPPopupController |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################################### | |
## ## | |
## Build and package OpenSSL static libraries for OSX/iOS ## | |
## ## | |
## This script is in the public domain. ## | |
## Creator : Laurent Etiemble ## | |
## ## | |
############################################################################### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See for converting from e to NSString: http://ios-blog.co.uk/tutorials/quick-tips/quick-tip-converting-nsstring-to-nsdata/ | |
@interface NSData (Encryption) | |
- (NSData *)AES256EncryptWithKey:(NSString *)key; | |
- (NSData *)AES256DecryptWithKey:(NSString *)key; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "NSData+Encryption.h" | |
#import <CommonCrypto/CommonCryptor.h> | |
@implementation NSData (Encryption) | |
- (NSData *)AES256EncryptWithKey:(NSString *)key { | |
// 'key' should be 32 bytes for AES256, will be null-padded otherwise | |
char keyPtr[kCCKeySizeAES256+1]; // room for terminator (unused) | |
bzero(keyPtr, sizeof(keyPtr)); // fill with zeroes (for padding) | |
// fetch key data |