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
#!/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
import requests
device_list = [{
"manufacturer": "LGE",
"model": "Nexus 5"
}, {
"manufacturer": "Motorola",
"model": "MotoG2"
}, {
"manufacturer": "LGE",
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);
extension UserDefaults {
var onboardingCompleted: Bool {
get { return bool(forKey: #function) }
set { set(newValue, forKey: #function) }
}
print(UserDefaults.standard.onboardingCompleted)
[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
[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
@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)
}
}
@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 / {