Skip to content

Instantly share code, notes, and snippets.

View vrudikov's full-sized avatar

Valentin vrudikov

  • Blackhorse Inc
  • Wastelands
View GitHub Profile
@vrudikov
vrudikov / JPACryptoConverter.java
Created April 24, 2017 10:48 — forked from simbo1905/JPACryptoConverter.java
JPA Converter which encrypts a column in the db
import java.security.Key;
import java.util.Properties;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import org.slf4j.Logger;
@vrudikov
vrudikov / dp1_target_image_creator.sh
Created January 6, 2017 14:09 — forked from steventroughtonsmith/dp1_target_image_creator.sh
Mac OS X Developer Preview 1 target partition creator for qemu-ppc
#!/bin/sh
TARGET_IMAGE=1G_BLANK_MACOSX_DP1_DISK_IMAGE.img
DISKSIZE_IN_BLOCKS=2097152
PRIMARY_PARTITIONSIZE_IN_BLOCKS=`expr $DISKSIZE_IN_BLOCKS - 512 - 16384 - 64`
pdisk $TARGET_IMAGE -initialize
pdisk $TARGET_IMAGE -createPartition MOSX_OF3_Booter Apple_HFS 64 16384
pdisk $TARGET_IMAGE -createPartition SecondaryLoader Apple_Loader 16448 512
@vrudikov
vrudikov / gist:d043778f5236d309b890b9413c9e71b9
Created December 26, 2016 19:47 — forked from aalmiray/gist:ccf26a213cb70b671078
Gradle multi-project build where project2's test classes depend on project1's test classes
.
├── build.gradle
├── project1
│ ├── build.gradle
│ └── src
│ └── test
│ └── java
│ └── sample
│ └── Foo.java
├── project2
@vrudikov
vrudikov / MessagingController.groovy
Created November 18, 2016 13:57 — forked from xmlking/MessagingController.groovy
How to secure WebSocket connections (WebSocket over STOMP) ? Grails sample app : https://github.com/xmlking/grails-batch-rest
import grails.plugin.springsecurity.annotation.Secured
import org.springframework.messaging.handler.annotation.DestinationVariable
import org.springframework.messaging.handler.annotation.MessageMapping
import org.springframework.messaging.handler.annotation.SendTo
import org.springframework.messaging.simp.annotation.SendToUser
import org.springframework.messaging.simp.annotation.SubscribeMapping
import org.sumo.apiapp.stomp.StompExceptionHandler
import java.security.Principal
@vrudikov
vrudikov / tomatousb-alsa-mpd.md
Created July 22, 2016 05:43 — forked from ruudud/tomatousb-alsa-mpd.md
Asus RT-AC66U TomatoUSB (kernel 2.6) with USB soundcard, Alsa, MPD, Spotify, Icecast and PulseAudio

This is some notes jotted down while trying to get an old USB sound card, connected to an Asus RT-AC66U router, to output music -- both from local MP3 files and Spotify.

Initially the idea was to run Mopidy on the router, but one of its core dependencies, libspotify, is not (yet) compiled for the MIPS architecture the Asus router runs under.

Maybe that will change some time: http://community.spotify.com/t5/Spotify-Ideas/libspotify-for-the-Mipsel-processor-Architecture/idi-p/36599

For now, Mopidy will have to run on another device on the network, and stream audio to the router.

@vrudikov
vrudikov / DateRange.swift
Created May 5, 2016 12:03 — forked from preble/DateRange.swift
Experimenting with creating a SequenceType for iterating over a range of dates. Blogged here: http://adampreble.net/blog/2014/09/iterating-over-range-of-dates-swift/
func < (left: NSDate, right: NSDate) -> Bool {
return left.compare(right) == NSComparisonResult.OrderedAscending
}
struct DateRange : SequenceType {
var calendar: NSCalendar
var startDate: NSDate
var endDate: NSDate
var stepUnits: NSCalendarUnit

Videos

@vrudikov
vrudikov / how-to-set-up-stress-free-ssl-on-os-x.md
Created April 15, 2016 18:43 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@vrudikov
vrudikov / Description
Created March 23, 2016 16:14 — forked from twasink/Description
Spring, Hibernate, HSQLDB and automatically creating tables
An example of using Spring and Hibernate together to automatically create a HSQLDB in-memory database for testing hibernate mappings.
@vrudikov
vrudikov / gist:cbf2f5642886f006225c
Created March 12, 2016 10:08 — forked from splittingred/gist:4689218
Example of modRest, a REST Client, in MODX 2.3.
$config = array(
'baseUrl' => rtrim('http://mywebsite.com/rest/api/','/'),
'format' => 'json', // json or xml, the format to request
'suppressSuffix' => false, // if false, will append .json or .xml to the URI requested
'username' => 'myuser', // if set, will use cURL auth to authenticate user
'password' => 'mypass',
'curlOptions' => array(
'timeout' => 30, // cURL timeout
'otherCurlOption' => 1,