Skip to content

Instantly share code, notes, and snippets.

View benjohnde's full-sized avatar
brewing code all day long

Ben John benjohnde

brewing code all day long
View GitHub Profile
@benjohnde
benjohnde / example
Created May 23, 2016 06:58 — forked from cedricwalter/example
Nginx configuration for JIRA, TeamCity, Nexus or any other Tomcat web application
## Server configuration for nginx to host Atlassian Jira / Jetbrain TeamCity or any other Tomcat web application
#
# author cedric.walter, www.waltercedric.com
# to be saved for ex in /etc/nginx/sites-available/example
server {
listen 80;
server_name jira.example.com;
access_log off;
location / {
@benjohnde
benjohnde / Timer.swift
Last active July 22, 2016 13:32
Timer and Blocks pre iOS 10
private class TimerActor {
var block: (Timer) -> Void
init(block: (Timer) -> Void) {
self.block = block
}
dynamic func fire(sender: Timer) {
block(sender)
}
}
[Unit]
Description=JIRA Service
After=network.service firewalld.service mysqld.service
[Service]
Type=forking
User=jira
Group=jira
ExecStart=/opt/atlassian/jira/bin/start-jira.sh
ExecStop=/opt/atlassian/jira/bin/stop-jira.sh
[Unit]
Description=Confluence Service
After=network.service firewalld.service mysqld.service
[Service]
Type=forking
User=confluence
Group=confluence
ExecStart=/opt/atlassian/confluence/bin/start-confluence.sh
ExecStop=/opt/atlassian/confluence/bin/stop-confluence.sh
extension UserDefaults {
var onboardingCompleted: Bool {
get { return bool(forKey: #function) }
set { set(newValue, forKey: #function) }
}
print(UserDefaults.standard.onboardingCompleted)
public class BarcodeScannerZXing implements BarcodeScannerService {
// RGBLuminanceSource of ZXing approximates luminance for faster barcode detection but can
// yield to different results in comparison with a Bitmap representation of the image
private void populateYUVLuminanceFromRGB(int[] rgb, byte[] yuv420sp, int width, int height) {
for (int i = 0; i < width * height; i++) {
float red = (rgb[i] >> 16) & 0xff;
float green = (rgb[i] >> 8) & 0xff;
float blue = (rgb[i]) & 0xff;
int luminance = (int) ((0.257f * red) + (0.504f * green) + (0.098f * blue) + 16);
yuv420sp[i] = (byte) (0xff & luminance);
import requests
device_list = [{
"manufacturer": "LGE",
"model": "Nexus 5"
}, {
"manufacturer": "Motorola",
"model": "MotoG2"
}, {
"manufacturer": "LGE",
#!/bin/bash
# (0) project-related definitions
PROJECT_NAME="AlgoreKit"
BUILD_DIR="./build"
CONFIGURATION="Release"
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# (1) make sure the output directory exists
@benjohnde
benjohnde / build_opencv_ios.sh
Last active October 25, 2017 08:43
Compilation error of dynamic framework for iOS (OpenCV 3.3.0)
#!/bin/bash
git clone [email protected]:opencv/opencv.git
cd opencv
git checkout 3.3.0
python platforms/ios/build_framework.py ios \
--dynamic \
--without imgcodec --without videoio --without video --without calib3d --without features2d \
--without objdetect --without dnn --without ml --without flann --without photo --without stitching \
--without cudaarithm --without cudabgsegm --without cudacodec --without cudafeatures2d \
--without cudafilters --without cudaimgproc --without cudalegacy --without cudaobjdetect \
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0 0 0 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>SFMono-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0 0 0 1</string>