Skip to content

Instantly share code, notes, and snippets.

@skuppa
skuppa / scala_example.md
Last active February 13, 2018 15:32
Scala Collection

Merge collection by group by

case class Channel(name: String,
                  deviceIds: List[String])

object Channel {
  def copy(c: Channel, newDevicesIds: List[String]) = c.copy(deviceIds = if(c.deviceIds == newDevicesIds) c.deviceIds else c.deviceIds ::: newDevicesIds)
}

def mergeDevices(channels: List[Channel]): Channel = { channels.foldLeft(channels.head) ((r, c) => Channel.copy(r, c.deviceIds)) }
@skuppa
skuppa / ios.md
Created April 12, 2015 03:22
Mac Tips

Export keychain into plain text

security dump-keychain -d login.keychain > keychain.txt

-- account : username
-- data : password
@skuppa
skuppa / gist:ffbd47a4d8a9cbaf7544
Last active August 29, 2015 14:17
Docker Tips

Images

Delete untagged docker images

docker rmi $(docker images -q --filter "dangling=true")

Logs

Read the docker log

docker logs -f 
@skuppa
skuppa / spring_boot.md
Last active August 29, 2015 14:16
Spring Boot Hints

Spring boot property loading order

Spring Boot looks for properties using a specific order:

  1. Command line arguments
  2. Java System properties (System.getProperties())
  3. OS environment variables
  4. JNDI attributes from java:comp/env
  5. A RandomValuePropertySource that only has properties in random.*
  6. Application properties outside of your packaged jar (application.properties including YAML and profile variants)
  7. Application properties packaged inside your jar (application.properties including YAML and profile variants)
@skuppa
skuppa / designer.html
Last active August 29, 2015 14:09
designer
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<polymer-element name="my-element">
<template>
<style>
@skuppa
skuppa / spring_mvc_tips.md
Created February 24, 2014 15:52
Spring MVC Tips

When Bad Request happens, most of the problem is in the data serialization and de-serialization. To get the detailed stack trace add the following in the log4j configuration or similar for logback.

    <logger name="org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod">
        <level value="trace"/>
    </logger>
@skuppa
skuppa / esxi_cli_reference.md
Created February 17, 2014 20:55
ESXi commandline reference

Managing ESXi requires one needs to have vSphere ESXi Cli tool to be installed. But, ESXi server itself has commands to manage the guest OS.

  • Login to console
ssh root@esxihost
  • Get all guest vms
# vim-cmd vmsvc/getallvms
@skuppa
skuppa / PostgresTips.md
Last active March 28, 2016 19:53
Postgres Tips

JDBC Driver

Name Value
artifact postgresql:postgresql:8.4-702.jdbc3
driver org.postgresql.Driver
JDBC url jdbc:postgresql://localhost:5432/testdb

Connecting Heroku Postgres

Use ssl to true and sslfactory as NonValidatingFactory

@skuppa
skuppa / GitTips.md
Last active August 29, 2015 13:56
Git Tips

Remove staged file after updating the .gitignore

$ echo 'out/' >> .gitignore
$ git rm -r --cached out/

Shelve Changes using Branch

If file is not committed locally

@skuppa
skuppa / HerokuTips.md
Last active July 16, 2017 08:35
heroku Tips

Tips to work with heroku

Adding key to heroku

It is required so you can push code heroku's git server and deploy

# Make sure the keys are available
ssh-add -l

# Add keys to heroku
heroku keys:add