Skip to content

Instantly share code, notes, and snippets.

View nkonev's full-sized avatar

Nikita Konev nkonev

View GitHub Profile
import java.lang.reflect.Method;
// http://www.quizful.net/post/java-reflection-api
public class ReflectionMath{
public static double reflectCall(String func, Object... args) throws Exception{
Method[] methods = Math.class.getMethods();
for(Method method: methods){
String name = method.getName();
if(name.equals(func)){
//Send questions, comments, bug reports, etc. to the authors:
//Rob Warner ([email protected])
//Robert Harris ([email protected])
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
@nkonev
nkonev / test-redir.bat
Created September 9, 2014 10:00
test-redir.bat
:: http://stackoverflow.com/questions/13399017/redirect-stdout-and-stderr-from-inside-a-batch-file
:: http://www.4its.ru/html/windows-cmd.html
:: перенавляем `>stdout.log` поток STDOUT(1) в файл stdout.log, также перенавляем `2>&1` STDERR(2) в STDOUT(1), чтобы они оба оказались в одном файле
>stdout.log 2>&1 (
echo Some text
:: здесь мы пишем в STDERR
echo Error 1>&2
# Сохранить креды для текушего репозитория(запускать из директории "расшаренного-через-git" проекта) в $HOME/.git-credentials
# см. project/.git/config секция [credential]
# http://git-scm.com/docs/git-credential-store
$ git config credential.helper store
$ git push origin
@nkonev
nkonev / gist:0d22f870a1a2aea18f2c
Last active November 7, 2015 05:19
Запуск процесса из groovysh
// http://groovy.codehaus.org/Process+Management
groovysh --terminal=none
["ping.exe", "first with space", "second"].execute().in.text
println "ping".execute().text
p = "ping".execute()
println p.in.text
println p.err.text
@nkonev
nkonev / gist:c98557aee9f47d2e1543
Created February 24, 2015 11:04
jaxb2-maven-plugin
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>xjc</id>
<phase>generate-sources</phase>
<goals>
<goal>xjc</goal>
#!/bin/sh
git push origin
mvn clean deploy -P ministand
cmd "/C call src\main\resources\external-ministand\bat\replace-configs-on-ministand.bat"
#mvn clean package
#curl http://192.168.38.39:8080/jenkins/git/notifyCommit?url=file:///c:/git-backup/TestManager-nikita-new.git
@nkonev
nkonev / README
Created September 20, 2015 00:53 — forked from rhamdeew/README
rhamdeew/lamp description
1. sudo docker pull rhamdeew/lamp
2. sudo docker run -v /your_empty_project_path/:/var/www/srv/ -p 80:80 -t -i rhamdeew/lamp /bin/bash
3. in container: cp -R /var/www/example/* /var/www/srv
4. in container: cd /var/www/srv/
5. in container: ./start.sh
6. open http://localhost/1.php
Your project structure
projectname/
@GrabConfig( systemClassLoader=true )
@Grapes(
@Grab(group='mysql', module='mysql-connector-java', version='5.1.26')
)
// create database groovy_mysql;
// create table words ( word_id BIGINT, spelling varchar(256), part_of_speech varchar(512), PRIMARY KEY(word_id));
// insert into words(word_id, spelling, part_of_speech) values (1, 'sam', 'bobcat');
import groovy.sql.Sql
delimiter $$
CREATE PROCEDURE my_sp7(patch_uuid varchar(36), sql_query varchar(1024))
BEGIN
IF NOT EXISTS (SELECT `uuid` FROM `patch` WHERE `uuid` = patch_uuid) THEN
INSERT INTO `patch` (`uuid`) VALUES (patch_uuid);
SET @mystate = sql_query;
PREPARE stmt FROM @mystate;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;