Skip to content

Instantly share code, notes, and snippets.

View vmptk's full-sized avatar
🐉
Focusing

Venelin vmptk

🐉
Focusing
View GitHub Profile
@webdevwilson
webdevwilson / monitor-directory.groovy
Created January 19, 2011 15:56
Groovy code to monitor a directory and copy modified files to a different directory
String.metaClass.div = { f -> delegate + File.separator + f }
def extensions = ['.jpg','.css','.js','.jsp']
def source = new File( args.length > 0 ? args[0] : '.' ).absolutePath
def dest = new File( args.length > 1 ? args[1] : discoverJBoss() ).absolutePath
println "Monitoring ${source}"
println "Any modified files will be copied to ${dest}"
def files = buildFileList(source, extensions)
@mpellegrini
mpellegrini / JacksonJsonSchemaGenerator.java
Last active March 18, 2020 13:03
Generate JSON Schema using Jackson
public static void main(String[] args) throws Exception {
ObjectMapper mapper = new ObjectMapper();
JsonSchemaGenerator generator = new JsonSchemaGenerator(mapper);
JsonSchema jsonSchema = generator.generateSchema(Subscription.class);
StringWriter json = new StringWriter();
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
mapper.writeValue(json, jsonSchema);
System.out.println(json.toString());
@hkhamm
hkhamm / installing_cassandra.md
Last active June 27, 2024 21:46
Installing Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@keyle
keyle / HDD.groovy
Created August 4, 2014 10:34
Groovy. Write objects to file (json) and read them back
package utils
import groovy.json.JsonBuilder
import groovy.json.JsonSlurper
class HDD {
static save(Object content, String filePath) {
new File(filePath).write(new JsonBuilder(content).toPrettyString())
}
@koistya
koistya / ReactJS-Server-Side-Rendering.md
Last active September 15, 2023 07:32
Server-side Rendering (SSR) for ReactJS / Flux Applications. Setting document.title

Files

The basic structure of a React+Flux application (see other examples)

 - /src/actions/AppActions.js     - Action creators (Flux)
 - /src/components/Application.js - The top-level React component
 - /src/constants/ActionTypes.js  - Action types (Flux)
 - /src/core/Dispatcher.js        - Dispatcher (Flux)
 - /src/stores/AppStore.js        - The main store (Flux)
@joepie91
joepie91 / .md
Last active October 7, 2024 15:56
Running a Node.js application using nvm as a systemd service

Read this first!

Hi there! Since this post was originally written, nvm has gained some new tools, and some people have suggested alternative (and potentially better) approaches for modern systems. Make sure to have a look at the comments to this article, before following this guide!


The original article

Trickier than it seems.

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@graemerocher
graemerocher / BookController.groovy
Last active July 29, 2016 13:25
BookController that uses RxJava and RxGORM for MongoDB
package rxgorm.demo
import grails.artefact.Controller
import grails.rx.web.Rx
import grails.validation.ValidationException
import groovy.transform.CompileStatic
import static org.springframework.http.HttpStatus.*
import static grails.rx.web.Rx.*
import static rx.Observable.*
@martinbuberl
martinbuberl / git-import-repository.md
Last active August 28, 2024 14:46
Import existing Git repository into another

Import existing Git repository into another

Folder structure before (2 separate repositories):

XXX
 |- .git
 |- (project files)
YYY
 |- .git
@sahilsk
sahilsk / kafka-cheat-sheet.md
Last active October 3, 2024 16:32 — forked from filipefigcorreia/kafka-cheat-sheet.md
Apache Kafka Cheat Sheet

Kafka Cheat Sheet

Display Topic Information

$ kafka-topics.sh --describe --zookeeper localhost:2181 --topic beacon
Topic:beacon	PartitionCount:6	ReplicationFactor:1	Configs:
	Topic: beacon	Partition: 0	Leader: 1	Replicas: 1	Isr: 1
	Topic: beacon	Partition: 1	Leader: 1	Replicas: 1	Isr: 1