Skip to content

Instantly share code, notes, and snippets.

@vito-c
vito-c / colorful_ps1.sh
Created October 8, 2020 04:08
I've lost my mind send doughnuts
#!/usr/local/bin/bash
function gradient() {
local start=$([ -z "${1+x}" ] && echo "255;0;0" || echo $1)
local end=$([ -z "${2+x}" ] && echo "0;0;255" || echo $2)
local text=$([ -z "${3+x}" ] && echo "/\/\/\/\/\/\/\/\/\/\/\/\/" || echo $3)
local perc=$([ -z "${4+x}" ] && echo "100" || echo $4)
local tcol=$(echo $text | wc -c)
local sr=$(echo $start | awk -F";" '{print $1}')
local sg=$(echo $start | awk -F";" '{print $2}')
@vito-c
vito-c / example.txt
Created August 15, 2020 20:06
Version Bumping Causing Conflicts
versions.txt | master
private val a = "1.2.3"
private val b = "1.2.3"
private val c = "1.2.3"
private val d = "1.2.3"
private val e = "1.2.3"
versions.txt | update-1
private val a = "BUMP"
private val b = "1.2.3"
@vito-c
vito-c / go
Last active December 26, 2017 12:37
Simple Plugin
package main
import (
"github.com/neovim/go-client/nvim"
"github.com/neovim/go-client/nvim/plugin"
"log"
"os"
)
func test(args []string) (string, error) {
@vito-c
vito-c / docker-compose.yaml
Created December 20, 2017 19:33
labels to enable headers for a different origin
# Currently I have something like this which works for Origin: foo.example.com
# I need to have something that works for foo.example.com and bar.example.com
# Host:www.example.com
# Origin:http://bar.example.com
# and
# Host:www.example.com
# Origin:http://foo.example.com
labels:
traefik.frontend.headers.customRequestHeaders: 'access-control-allow-origin:http://foo.example.com||
@vito-c
vito-c / 768.scala
Last active November 19, 2017 07:47
times out with more 768+ items
// I've got the weirdest bug that I just ran into ... so when I execute this Future.sequence with more
// 768 or more items in it the whole thing times out after 50 seconds but when I run it with 767 it
// completes within 10 seconds. If I execute the 768th to last 968th item it works fine... It's a really weird
case XUserList(roster) =>
val num = 767
log.info(s"ROSTER ENTRIES ${roster.length}")
log.info(s"ROSTER ENTRIES ${roster(num)}")
log.info(s"ROSTER ENTRIES ${roster(num+1)}")
val out: Future[List[User]] = if(_usersDirty == true) {
log.info("fresh users to map")
@vito-c
vito-c / gist:0b4f7745b6ec6db7e94d4eb015267667
Created October 26, 2017 18:35
gif image magick (magic)
# gif resizing
gifsicle -i foobar.gif --resize 240x_ > foobar-240.gif
# fuzz gif to reduce quality and size
convert foobar.gif -fuzz 5% -layers Optimize foobar_05.gif
# infinite looper
convert foobar.gif -coalesce -duplicate 1,-2-1 -quiet -layers OptimizePlus -loop 0 foobar_loop.gif
@vito-c
vito-c / test.yaml
Created October 6, 2017 00:17
Not sure this will even work but you get the gist
---
version: '2'
services:
traefik:
container_name: traefik
image: traefik
ports:
- "80:80"
- "8080:8080"
volumes:
@vito-c
vito-c / cmake boost withe errors
Created September 23, 2017 04:55
linking errors in cmake
################################################################
# A minimal CMake file that is compatible with sbt-jni #
# #
# All settings required by sbt-jni have been marked so, please #
# add/modify/remove settings to build your specific library. #
################################################################
cmake_minimum_required(VERSION 2.8.0)
# Define project and related variables

I'm getting this error...

Cannot find a value of type: [slick.basic.DatabaseConfig[com.test.database.MyPostgresDriver]]
[error]   protected lazy val testDao: TestComponent = wire[TestDao]

my dao:

class TestDao(
@vito-c
vito-c / daoapptest.scala
Last active September 4, 2017 17:11
Dao Test
package com.blah.database.dao
import java.lang.Thread
import play.api.Application
import org.scalatest.{FunSuite, Matchers, BeforeAndAfter}
import play.api.{Application, ApplicationLoader, Environment, Mode}
import com.dimafeng.testcontainers.{ForAllTestContainer, GenericContainer}
import org.testcontainers.containers.wait.Wait
import org.scalatestplus.play.FakeApplicationFactory
import play.api.db.{Database, DBComponents, HikariCPComponents}