Skip to content

Instantly share code, notes, and snippets.

View ognjenm's full-sized avatar

Ognjen Miletić ognjenm

View GitHub Profile
@ognjenm
ognjenm / getAttachments.java
Created December 30, 2018 12:46
get Attachments from word document
Document doc = new Document(getMyDir() + “sample2.doc”);
NodeCollection shapes = doc.getChildNodes(NodeType.SHAPE, true);
for (Shape shape : (Iterable) shapes)
{
if (shape.getOleFormat() != null)
{
if (!shape.getOleFormat().isLink())
{
#!/bin/sh
# save current dir
CUR_DIR=`pwd`
SCRIPT="$0"
# SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
@ognjenm
ognjenm / git.migrate
Created March 24, 2018 21:27 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
/*
* Copyright 2013-2018 Erudika. https://erudika.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
#!/bin/bash
echo "Listing all tags:"
git tag
echo "---"
read -e -p "Version tag: " ver
read -e -p "Last version tag: " lastver
read -e -p "New dev version: " devver
git add -A && git commit -m "Release v$ver." && git push origin master
mvn --batch-mode -Dtag=${ver} release:prepare -DreleaseVersion=${ver} -DdevelopmentVersion=${devver}-SNAPSHOT && \
@ognjenm
ognjenm / gist:3b04fa923a81cfcaf208a0f54380cc80
Created April 16, 2017 22:15 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@ognjenm
ognjenm / shrinkpdf.sh
Created April 16, 2017 14:28
Reduces PDF filesize by lossy recompressing with Ghostscript
#!/bin/sh
# http://www.alfredklomp.com/programming/shrinkpdf
# Licensed under the 3-clause BSD license:
#
# Copyright (c) 2014, Alfred Klomp
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@ognjenm
ognjenm / pom-template.xml
Created April 6, 2017 20:48 — forked from superalsrk/pom-template.xml
pom template
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.loli</groupId>
<artifactId>lolibox</artifactId>
<version>0.0.1-SNAPSHOT</version>
<url>https://github.com/chocotan/lolibox</url>
<name>io.loli.lolibox</name>
<developers>
<developer>
<id>choco</id>
# Script by rootArtisan http://rootartisan.com
# Use at your own risk. This script allow you to quick install laravel and take care of all the permissions.
# Usage instructions http://www.rootartisan.com/blog/installing-laravel-withing-seconds
echo "Enter Laravel Project Name."
read project_name
echo "What post to listen to?"
read port
echo "App will run on localhost:" $post
@ognjenm
ognjenm / MySqlSlug
Created September 25, 2016 08:28
MySQL create slug from title
UPDATE some_table SET slug = LOWER(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(title_field),'ž',''),'đ',''),'š',''),'ć',''),'č',''), ':', ''), ')', ''), '(', ''), ',', ''), '\\', ''), '\/', ''), '\"', ''), '?', ''), '\'', ''), '&', ''), '!', ''), '.', ''), ' ', '-'), '--', '-'), '--', '-'))
WHERE slug = '';