Skip to content

Instantly share code, notes, and snippets.

yUML Test On GitHub

yUML is a simple tool for embedding UML diagrams in wikis and blogs without needing any UML or diagramming tools.

Here's an idea of how it could be used in your repository readme.markdown or wiki.

View the RAW source to see how images are made.

Example markdown codes below

@zionyx
zionyx / SemVer.groovy
Created March 12, 2020 15:14 — forked from michaellihs/SemVer.groovy
Semantic Versioning class for Groovy
enum PatchLevel {
MAJOR, MINOR, PATCH
}
class SemVer implements Serializable {
private int major, minor, patch
SemVer(String version) {
def versionParts = version.tokenize('.')
@zionyx
zionyx / map2Json.groovy
Created March 1, 2020 21:35 — forked from rdmueller/map2Json.groovy
This Gist demonstrate how to serialize a Map to JSON and YAML with Groovy
//Problem:
//languages like tcl can simply switch between the String representation of a map or list and the
//object itself. In Groovy, this could theoretically work, but it doesn't:
def list1 = [1,2,3]
def list2 = ["1, 2, 3"]
assert list1 != list2
assert list1.toString() == list2.toString()
assert Eval.me(list1.toString()) instanceof List
assert Eval.me(list2.toString()) instanceof List
assert Eval.me(list1.toString()) == Eval.me(list2.toString())
@zionyx
zionyx / gist:b604170fe14a40af2c41e27e750f1ee5
Last active August 18, 2021 07:23 — forked from jaturken/gist:3976117
Scala features cheatsheet

Scala Cheat Sheet

This cheat sheet originated from the forum, credits to Laurent Poulain. We copied it and changed or added a few things.

Evaluation Rules

  • Call by value: evaluates the function arguments before calling the function
  • Call by name: evaluates the function first, and then evaluates the arguments if need be
@zionyx
zionyx / gist:403027aa4752bb382a44308fbe8c4470
Created November 30, 2016 13:53 — forked from trodrigues/gist:1023167
Checkout only certain branches with git-svn
If you want to clone an svn repository with git-svn but don't want it to push all the existing branches, here's what you should do.
* Clone with git-svn using the -T parameter to define your trunk path inside the svnrepo, at the same time instructing it to clone only the trunk:
git svn clone -T trunk http://example.com/PROJECT
* If instead of cloning trunk you just want to clone a certain branch, do the same thing but change the path given to -T:
git svn clone -T branches/somefeature http://example.com/PROJECT
@zionyx
zionyx / Create-Jenkins-Slave-On-Windows-Server-Core.ps1
Last active October 7, 2016 22:02 — forked from PlagueHO/ Create-Jenkins-Slave-On-Windows-Server-Core.ps1
Create a Jenkins Slave on a Windows Server 2012 R2 Core install
# Configure the settings to use to setup this Jenkins Slave
$IPAddress = '192.168.1.96'
$SubnetPrefixLength = 24
$DNSServers = @('192.168.1.1')
$DefaultGateway = '192.168.1.1'
$JenkinsSlaveFolder = 'c:\jenkins'
# Install .NET Framework 3.5
Install-WindowsFeature -Name NET-Framework-Core
@zionyx
zionyx / cleanupUnusedWorkspaceInSlaves.groovy
Created September 16, 2016 13:17 — forked from ceilfors/cleanupUnusedWorkspaceInSlaves.groovy
When you delete jobs in Jenkins, the corresponding workspaces in the build slaves won't be deleted automatically. This Jenkins script will go to each slave and check if the jobs are already deleted in Jenkins master and delete the workspace.
import com.cloudbees.hudson.plugins.folder.Folder
import hudson.FilePath
import jenkins.model.Jenkins
def boolean isFolder(String name) {
def item = Jenkins.instance.getItemByFullName(name)
return item instanceof Folder
}
def deleteUnusedWorkspace(FilePath root, String path) {
# -*- coding: utf-8 -*-
"""Demonstrate high quality docstrings.
Module-level docstrings appear as the first "statement" in a module. Remember,
that while strings are regular Python statements, comments are not, so an
inline comment may precede the module-level docstring.
After importing a module, you can access this special string object through the
``__doc__`` attribute; yes, it's actually available as a runtime attribute,
despite not being given an explicit name! The ``__doc__`` attribute is also
@zionyx
zionyx / setupVSEnv.py
Last active June 11, 2016 22:04 — forked from stania/setupVSEnv.py
python implementation replacing "call vsvars32.bat"
import os
import subprocess as sub
def vs_env_dict(vsver):
cmd = r'cmd /s /c ""%VS{0}COMNTOOLS%vsvars32.bat" & set"'.format(vsver)
output = sub.Popen(cmd, stdout=sub.PIPE, stderr=sub.STDOUT, stdin=sub.PIPE).communicate()[0].split(os.linesep)
return dict((e[0].upper(), e[1]) for e in [p.rstrip().split("=", 1) for p in output] if len(e) == 2)
@zionyx
zionyx / largestFiles.py
Created September 7, 2015 12:21 — forked from nk9/largestFiles.py
Python script to find the largest files in a git repository.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.