Skip to content

Instantly share code, notes, and snippets.

@bobbypage
bobbypage / main.go
Last active January 15, 2021 05:01
shutdown-example-app
/*
Dockerfile
FROM golang:1.15 AS builder
WORKDIR /shutdown-example-app
COPY main.go /shutdown-example-app
RUN go build -o shutdown-example-app
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o shutdown-example-app .
FROM scratch
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 5.4.0-1029-gcp Kernel Configuration
#
#
# Compiler: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
#
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=90300
Sending build context to Docker daemon 94.62MB
Step 1/21 : FROM alpine:3.12 AS build
---> d6e46aa2470d
Step 2/21 : RUN apk --no-cache add libc6-compat device-mapper findutils zfs build-base linux-headers go bash git wget cmake pkgconfig ndctl-dev && apk --no-cache add thin-provisioning-tools --repository http://dl-3.alpinelinux.org/alpine/edge/main/ && echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf && rm -rf /var/cache/apk/*
---> Running in 3cb87592a56b
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/69) Upgrading musl (1.1.24-r9 -> 1.1.24-r10)
(2/69) Installing ncurses-terminfo-base (6.2_p20200523-r0)
(3/69) Installing ncurses-libs (6.2_p20200523-r0)
package main
import (
"fmt"
"os"
"time"
"github.com/godbus/dbus/v5"
)
@bobbypage
bobbypage / gist:f922d2dea47912786ddc0a0d2fab0fd1
Last active June 3, 2020 00:10
Setting up VM to run Node E2E tests locally

gcloud compute instances create ubuntu-dev-machine --machine-type=n1-standard-16 --image-family="ubuntu-1804-lts" --image-project="ubuntu-os-cloud" --zone=us-central1-c --boot-disk-size=200GB --boot-disk-type=pd-ssd

gcloud compute ssh ubuntu-dev-machine
 
sudo apt-get update

sudo apt-get -y install build-essential
 
#user.rb
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
#user.rb
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
//Under Facebook.m
- (void)authorizeWithFBAppAuth:(BOOL)tryFBAppAuth
safariAuth:(BOOL)trySafariAuth {
//Disable Facebook App Auth and only use native popup auth
tryFBAppAuth = NO;
trySafariAuth = NO;
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
_appId, @"client_id",
@bobbypage
bobbypage / Compare UIColor
Created March 1, 2011 02:47
Way to compare two UIColors
- (BOOL)compareColors:(UIColor *)firstColor toSecondColor:(UIColor *)toSecondColor {
BOOL areColorsEqual = CGColorEqualToColor(firstColor.CGColor, toSecondColor.CGColor);
return areColorsEqual;
}