Skip to content

Instantly share code, notes, and snippets.

View darsd's full-sized avatar

Dariusz Sadowski darsd

View GitHub Profile
@darsd
darsd / .gitconfig
Last active June 17, 2023 16:17
2021 Configs
[user]
name = Dariusz Sadowski
email = dariusz.sadowski@work.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
#excludesfile = /home/dsdw/.gitignore
[web]
browser = google-chrome
[rerere]
@darsd
darsd / config_update.sh
Created February 24, 2020 15:02
Traefik @ Docker Swarm
docker config create traefik.toml-1.1.0 traefik.toml
docker service update --config-rm traefik.toml-1.0.0 --config-add source=traefik.toml-1.1.0,target=traefik.toml edge-router_proxy
@darsd
darsd / traefik-compose.yml
Created January 8, 2019 14:22
Docker Swarm Traefik Stack
version: "3.4"
services:
proxy:
image: traefik:latest
command:
- "--api"
- "--entrypoints=Name:http Address::80 Redirect.EntryPoint:https"
- "--entrypoints=Name:https Address::443 TLS"
- "--defaultentrypoints=http,https"
- "--acme"
@darsd
darsd / gist:0c445faf2b670ca508338000b13602f5
Created February 12, 2017 22:31 — forked from jimbojsb/gist:1630790
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

Getting Started in Scala

This is my attempt to give Scala newcomers a quick-and-easy rundown to the prerequisite steps they need to a) try Scala, and b) get a standard project up and running on their machine. I'm not going to talk about the language at all; there are plenty of better resources a google search away. This is just focused on the prerequisite tooling and machine setup. I will not be assuming you have any background in JVM languages. So if you're coming from Python, Ruby, JavaScript, Haskell, or anywhere…  I hope to present the information you need without assuming anything.

Disclaimer It has been over a decade since I was new to Scala, and when I was new to Scala, I was coming from a Java and Ruby background. This has probably caused me to unknowingly make some assumptions. Please feel free to call me out in comments/tweets!

One assumption I'm knowingly making is that you're on a Unix-like platform. Sorry, Windows users.

Getting the JVM

<?php
class SomeHandler
{
/**
* @var RepositoryInterface
*/
private $repository;
public function __construct(RepositoryInterface $repository) {
@darsd
darsd / savingsaccount.sc
Created October 27, 2015 23:07
Savings account problem
import java.util.{Calendar, Date}
class SavingsAccount(amount: Int, percent: Double, openDate: Date) {
def annualInterest() : Int = {
(amount * percent).round.toInt
}
def monthlyInterest() : Int = {
annualInterest() / 12
@darsd
darsd / .gitconfig
Last active March 6, 2017 10:24
My Git configuration
[user]
name = User Example
email = user@example.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
#excludesfile = /home/dsdw/.gitignore
[web]
browser = google-chrome
[rerere]
@darsd
darsd / gist:5132981
Created March 11, 2013 09:17
Regular expression for: .... "() { something }"
\(\)\n\s*\{\n\s*.*\n\s*\}
@darsd
darsd / gist:4970906
Created February 17, 2013 10:25
.bash_aliases
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# Dariusz Sadowski - http://darsadow.com - added host name after time so I know where I am
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset