Skip to content

Instantly share code, notes, and snippets.

// please check https://github.com/bademux/robolectric-java-gradle-plugin instead
//build.gradle
//fixes AndroidStudion<>Robolectric integration
//fixes 'java.lang.RuntimeException: Stub!' and 'NoClassDefFoundError'
gradle.projectsEvaluated {
def imlFile = file(project.name + '.iml')
def parsedXml;
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# License: MIT
# copy file to ~/.gimp-2.8/plug-ins and make it executeble, then run gimp with comdline
# gimp -ib '(python-wim RUN-NONINTERACTIVE "mytemplate.xcf" "guest_list.txt" "outdir")''(gimp-quit 0)'
import os, re, glob
from gimpfu import *
from gimpenums import *
@bademux
bademux / image_merger.py
Last active August 29, 2015 14:20
quick and dirty image merger
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# License: MIT
#quick and dirty image merger
#gimp -ib '(python-copy2a4 RUN-NONINTERACTIVE "~/pics" "inv_*.png" "~/pics")''(gimp-quit 0)'
import os, re, glob
from gimpfu import *
from gimpenums import *
# our script
// predicates filter to extjs query format
//usage put in html <input st-search="like['test.text']">
//then parse SmartTable's tableState var criteria = queryParserFilter(tableState);
myModule
.filter('queryParser', function () {
return function (tableState) {
var criteria = {
start: tableState.pagination.start,
limit: tableState.pagination.number
};
@Configuration
public class JacksonConfig {
//TODO: Autoscan
final static Map<Class<?>, Class<?>> mixins = ImmutableMap.<Class<?>, Class<?>>builder()
.put(..., ...)
.build();
@Autowired
EntityManagerFactory emf;
@bademux
bademux / StringParametrizedIntegrationTest.java
Last active August 15, 2018 08:26
Spring Parametrized Integration Test, SpringJUnit4ClassRunnerFactory usage example
@Parameterized.UseParametersRunnerFactory(SpringJUnit4ClassRunnerFactory.class)
@RunWith(Parameterized.class)
@SpringTestConfiguration
@Transactional
public class StringParametrizedIntegrationTest {
@Parameterized.Parameter
public String uri;
@Parameterized.Parameters(name = "{index}: for {0} ")
@bademux
bademux / MockitoTest.java
Created November 6, 2015 15:38
Mockito Parametrized UnitTest, MockitoClassRunnerFactory usage example
@Parameterized.UseParametersRunnerFactory(MockitoClassRunnerFactory.class)
@RunWith(Parameterized.class)
public class JobServiceSetStatusCheckIsManualTest {
@Parameterized.Parameter
public State state;
@Parameterized.Parameters(name = "{index}: expected {0}")
public static Collection<?> data() {
return Arrays.asList(new Object[][]{{"test"}});
class InitDynamoDBConfig{
{
ConversionSchema schema = v2CompatibleBuilder("v2CompatibleWithUuidAsByteBuffer")
.addFirstType(UUID.class, UUIDToByteBuffer.Marshaller.instance(), UUIDToByteBuffer.Unmarshaller.instance())
.build()
DynamoDBMapperConfig config = new DynamoDBMapperConfig.Builder()
.withConversionSchema(schema)
.withTableNameResolver(tableNameResolver)
.build();
@bademux
bademux / latest-widevine.sh
Created February 9, 2018 21:22 — forked from ruario/intro-latest-widevine.md
Fetches the latest Linux Widevine binary so that it can be used by Vivaldi.
#!/usr/bin/env bash
available () {
command -v $1 >/dev/null 2>&1
}
# Make sure we have wget or curl
if available wget; then
SILENT_DL="wget -qO-"
LOUD_DL="wget"
@bademux
bademux / dch2ihx.py
Last active February 15, 2019 15:03
Converts uCsim dumps to ihx format
#!/usr/bin/env python2.7
# Converts uCsim dumps to ihx format https://en.wikipedia.org/wiki/Intel_HEX
# 'dch 0xXX 0xXX 16' dumps ROM to multiple rows formated like {adress} {byte 1} ... {byte 16} {ASCI_representation}
import argparse
import sys
NUMBER_OF_BYTES = 16
def parse_arguments():