Skip to content

Instantly share code, notes, and snippets.

View anataliocs's full-sized avatar
Working on Stellar Quest 3

Chris Anatalio anataliocs

Working on Stellar Quest 3
View GitHub Profile

Keybase proof

I hereby claim:

  • I am anataliocs on github.
  • I am anataliocs (https://keybase.io/anataliocs) on keybase.
  • I have a public key ASDzqcwpJiwvYsmmnKBmzLLbYoL_2mimQGdR0vzjBTc9UAo

To claim this, I am signing this object:

@anataliocs
anataliocs / run_dynamodb_local.sh
Created November 21, 2016 18:34 — forked from zircote/run_dynamodb_local.sh
A quick run script to get a AWS DynamoDB Local instance going
#!/bin/sh
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
RUN_DIR=${DIR}/.dynamodb
DYNAMODB_LOCAL="http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz"
PORT=8000
ARGS="-inMemory -port ${PORT}"
install_dynamo_db(){
mkdir -p $1
curl -L $2 | tar xvz -C $1
@anataliocs
anataliocs / FucksGiven.java
Created April 13, 2016 15:36
fucks given
public int getNumberOfFucksGiven() {
Calendar today = Calendar.getInstance();
switch(today.get(Calendar.DAY_OF_WEEK)) {
case Calendar.MONDAY: return 0;
case Calendar.TUESDAY: return 0;
case Calendar.WEDNESDAY: return 0;
case Calendar.THURSDAY: return 0;
case Calendar.FRIDAY: return 0;
case Calendar.SATURDAY: return 0;
@anataliocs
anataliocs / Nonchalantly.java
Last active August 29, 2015 14:27 — forked from poetix/Nonchalantly.java
A Java 8 class to handle checked exceptions
public interface Nonchalantly<T> {
static <T> T invoke(Nonchalantly<T> f) {
try {
return f.run();
} catch (Throwable e) {
throw new RuntimeException( e );
}
}
T run() throws Throwable;
@anataliocs
anataliocs / CacheConfig.java
Last active August 4, 2024 04:24
Guava cache with spring boot and clear cache method
import com.google.common.cache.CacheBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.guava.GuavaCache;
import org.springframework.cache.interceptor.CacheErrorHandler;
import org.springframework.cache.interceptor.CacheResolver;
import org.springframework.cache.interceptor.KeyGenerator;
@anataliocs
anataliocs / Application.java
Last active September 1, 2022 18:21
Validation messages in messages.properties file for i18n internationalization by locale in spring boot
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@RequestMapping("/")
@ResponseBody
String home() {
@anataliocs
anataliocs / oracle-config-jhipster.yaml
Created May 15, 2015 19:11
Oracle config for jHipster Spring Boot App
spring:
profiles: dev
datasource:
driverClassName: oracle.jdbc.OracleDriver
dataSourceClassName: oracle.jdbc.pool.OracleDataSource
url: jdbc:oracle:thin:@localhost:1521:orcl
username: rest_test
password: rest_test
jpa:
@anataliocs
anataliocs / twitter.xml
Last active August 29, 2015 13:56 — forked from FranckSilvestre/twitter.xml
Twitter feed module for Google Sites
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="RTS Labs on Twitter" />
<Content type="html">
<![CDATA[
<a class="twitter-timeline" href="https://twitter.com/rtslabs" data-widget-id="433285134742085632">Tweets de @rtslabs</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
]]>
</Content>
</Module>
@anataliocs
anataliocs / javadates.java
Created October 23, 2013 19:03
Java dates date conversion
calendar cal = new GregorianCalendar(TimeZone.getTimeZone("EST5EDT"));
String birthDate = (String)report.get("birthDateDay") + " " + (String)report.get("birthDateMonth") + " " + (String)report.get("birthDateYear");
SimpleDateFormat sdf = new SimpleDateFormat("dd MM yyyy");
ageVal = new Date().getTime() - sdf.parse(birthDate).getTime();
ageVal /= 31536000000l; // covert milliseconds to years
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("EST5EDT"));
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy");
sdf.setCalendar(cal);
cal.setTime(date);
@anataliocs
anataliocs / dates.txt
Created October 23, 2013 19:00
SQL date conversions date range
WHERE DATE BETWEEN '09/16/2010 05:00:00' and '09/21/2010 09:00:00'
Convert SQL Server timestamp into date
CONVERT(char(10), Dateadd(second, (createStamp/1000), '01/01/1970'), 101) as Created