Skip to content

Instantly share code, notes, and snippets.

Avatar
🐷
coding

Igor Maznitsa raydac

🐷
coding
View GitHub Profile
@raydac
raydac / IcnsGen.java
Last active Nov 2, 2019
Java class to generate ICNS from image under MacOS
View IcnsGen.java
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.nio.file.FileSystems;
import java.nio.file.Path;
@raydac
raydac / AbstractFsm.java
Last active Jul 27, 2018
Auxiliary Java class to organize FSM
View AbstractFsm.java
package com.igormaznitsa.misc;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@raydac
raydac / gist:2d7bb49494b55ffd1bfc91a4616723ca
Last active Apr 22, 2017
Script to make UDEV rule (for Ubuntu 16.04) to enable access of "scanner" group to port of Brother DCP-7055
View gist:2d7bb49494b55ffd1bfc91a4616723ca
#!/bin/bash
echo Make rule to enable USB port of Brother DCP-7055
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
RULE_FOLDER=/etc/udev/rules.d
@raydac
raydac / class2jbbp
Last active Jun 25, 2016
Function to generate [JBBP DSL script](https://github.com/raydac/java-binary-block-parser) from a class contains fields marked by `@Bin` annotations
View class2jbbp
/**
* Generates <a href="https://github.com/raydac/java-binary-block-parser">JBBP DSL script</a> from class @BIN annotated fields. Extra field of @BIN annotation is used as expression for array length if the text starts with 'expr:'
* <p>Example code:
* <pre>{@code
* public static class Chunk {
* @Bin(outOrder = 1, type = BinType.INT)
* int length;
* @Bin(outOrder = 2, type = BinType.INT)
* int type;
* @Bin(outOrder = 3, type = BinType.BYTE_ARRAY, extra = "expr:length")
@raydac
raydac / Arrow.java
Created Dec 6, 2015
Draw arrows in Java Swing
View Arrow.java
package com.presidentgame.game.utils;
import com.igormaznitsa.jhexed.engine.HexEngine;
import java.awt.Graphics2D;
import java.awt.Stroke;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
public enum Arrow {;
@raydac
raydac / initscanner
Created Oct 7, 2015
Bash script to provide needed rights for USB port for Brother DCP-7055
View initscanner
#!/bin/bash
echo
echo The Script provides needed rights for USB port of a scanner
echo it was developed for MFC Brother DCP7055 to avoid 'invalid argument' error
echo
echo Author : Igor Maznitsa \(http://www.igormaznitsa.com\)
echo Version: 1.00
echo
@raydac
raydac / JHtmlLabel.java
Created Aug 25, 2015
an adaptation of javax.swing.JLabel to process clicks on links in HTML content
View JHtmlLabel.java
/*
* Copyright 2015 Igor Maznitsa.
*
* 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