Skip to content

Instantly share code, notes, and snippets.

View TimGraf's full-sized avatar
:shipit:
GSD

Tim Graf TimGraf

:shipit:
GSD
View GitHub Profile
def __init__(self):
logger.info('Setting up chrome web driver.')
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("window-size=1400,2100")
chrome_options.add_argument('--disable-gpu')
FROM python:3.7
RUN apt-get update
RUN apt-get install -y gconf-service libasound2 libatk1.0-0 libcairo2 libcups2 libfontconfig1 libgdk-pixbuf2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libxss1 fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils
#download and install chrome
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install
#install python dependencies
Dockerfile
# Stage 1
FROM microsoft/dotnet:2.2-sdk AS builder
WORKDIR /source
# caches restore result by copying csproj file separately
COPY *.csproj .
# COPY NuGet.Config .
RUN dotnet restore
""" Scheduler URLs """
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
from . views import SchedulerView
from . scheduler import Scheduler
urlpatterns = {
url(r'^', SchedulerView.as_view(), name='scheduler')
""" Scheduler Singleton """
import sched
import time
import datetime
import threading
import logging
from multiprocessing import Process, log_to_stderr
mvn archetype:generate -DgroupId=com.test.app -DartifactId=test-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
// Project name (artifact name in Maven)
name := "(project name)"
// orgnization name (e.g., the package name of the project)
organization := "com."
version := "1.0-SNAPSHOT"
// project description
description := "(project description)"
@TimGraf
TimGraf / vault.service
Created January 23, 2017 23:43 — forked from yunano/vault.service
/etc/systemd/system/vault.service
[Unit]
Description=vault server
Requires=network-online.target
After=network-online.target consul.service
[Service]
EnvironmentFile=-/etc/sysconfig/vault
Restart=on-failure
ExecStart=/usr/local/sbin/vault server $OPTIONS -config=/etc/vault.d
ExecStartPost=/bin/bash -c "for key in $KEYS; do /usr/local/sbin/vault unseal $CERT $key; done"
@TimGraf
TimGraf / singleton-only.scala
Created June 6, 2016 21:25 — forked from milessabin/singleton-only.scala
Scala type which can only be extended by an object, not by a non-abstract type ...
scala> class Foo { self: Singleton => }
defined class Foo
scala> class Bar extends Foo
<console>:12: error: illegal inheritance;
self-type Bar does not conform to Foo's selftype Foo with Singleton
class Bar extends Foo
^
scala> object Bar extends Foo
@TimGraf
TimGraf / gist:f40b13e42c06f91c4416
Created March 15, 2016 01:05 — forked from rasjones/gist:f347f148b9a8787049a6
Swagger Akka HTTP MicroServices Example
import akka.actor.ActorSystem
import akka.event.{Logging, LoggingAdapter}
import akka.http.scaladsl.Http
import akka.http.scaladsl.client.RequestBuilding
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import akka.http.scaladsl.marshalling._
import akka.http.scaladsl.model._
import akka.http.scaladsl.model.StatusCodes._
import akka.http.scaladsl.server.Directives
import akka.http.scaladsl.server.Directives._