Skip to content

Instantly share code, notes, and snippets.

View calvincodes's full-sized avatar
😬
Breaking Things

Arpit Jain calvincodes

😬
Breaking Things
View GitHub Profile
{
"msg": "Hi Bob, I will be able to attend the party."
}
@calvincodes
calvincodes / jwt_header.json
Last active August 13, 2019 18:00
Sample JWT Header
{
"alg": "HS256",
"typ": "JWT"
}
val updateSecretRequest =
new UpdateSecretRequest().
withSecretId(secretId).
withKmsKeyId(newKmsKeyId).
withSecretString(newSecretString)
awsSecretsManager.updateSecret(updateSecretRequest)
0.0 <= H <= 50.0 and 0.23 <= S <= 0.68
and R > 95 and G > 40 and B > 20 and R > G
and R > B and | R - G | > 15 and A > 15
#include <stdio.h>
#include <sys/types.h>
int main() {
// Infinite Loop
while(1){
// Fork will create another CLONE process.
// Being a clone of the parent, child process
// will also CLONE a copy of itself.
protected void entityIsPersistent(PersistEvent event, Map createCache) {
LOG.trace( "Ignoring persistent instance" );
final EventSource source = event.getSession();
//TODO: check that entry.getIdentifier().equals(requestedId)
final Object entity = source.getPersistenceContext().unproxy( event.getObject() );
final EntityPersister persister = source.getEntityPersister( event.getEntityName(), entity );
if ( createCache.put( entity, entity ) == null ) {
private void persistTransientBeanWithId() {
// Get a non managed (Transient) product object - Having id set
Product transientProductWithId = ProductMother.getBasicProduct();
dao.update(transientProductWithId, "New Brand Name");
}
private void persistTransientBeanWithoutId() {
// Get a non managed (Transient) product object - And reset ID to null
// This will result in creation of product
Product transientProductWithoutId = ProductMother.getBasicProduct();
@Component
public class ProductDaoImpl implements ProductDao {
@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager entityManager;
public Product findById(Long id) {
return entityManager.find(Product.class, id);
}
<bean id="customConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="file:${catalina.base}/conf/config2.properties"/>
<property name="ignoreUnresolvablePlaceholders" value="true"/>
<property name="order" value="-2147483648"/>
</bean?
<bean id=“configurer1" class=“org.springframework.beans.factory.config.PropertyPlaceholderConfigurer”>
<property name="location" value="file:${catalina.base}/conf/config1.properties"/>
<property name="ignoreUnresolvablePlaceholders" value="true"/>
</bean>
<bean id="customConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="file:${catalina.base}/conf/config2.properties"/>
<property name="ignoreUnresolvablePlaceholders" value="true"/>
<property name="valueSeparator" value="-defVal-"/>
</bean>