Skip to content

Instantly share code, notes, and snippets.

View jinahya's full-sized avatar

Jin Kwon jinahya

  • Wemakeprice
  • Seoul, Korea
View GitHub Profile
/**
* A class whose {@code main(String[])} method
* prints {@code hello, world\n} to {@code System.out}.
*
* @author Jin Kwon <jinahya_at_gmail.com>
*/
public class HelloWorld {
/**
* Prints "hello, world\n" to {@code System.out}.
@jinahya
jinahya / LogRecorderExample.java
Created January 16, 2015 12:38
Recording Logs with LogBack
import static com.github.jinahya.logback.core.LogRecorderReflector;
import org.slf4j.Logger;
public class LogRecoderExample {
public static void main(final String[] args)
throws ReflectiveOperationException {
final String records;
final LogRecorder recorder = LogRecorderReflector.start(
getLogger(Logger.ROOT_LOGGER_NAME), // the logger whose log events are recorded
"%message%n", // the pattern for formatting log events
@jinahya
jinahya / qt5.ubuntu.dependencies.sh
Last active June 13, 2018 08:15
A script installs required dependencies of Qt 5 on Uubuntu
#!/bin/sh
#Linux/X11
sudo apt-get build-dep qt5-default
#Build essentials
sudo apt-get -y install build-essential perl python git
#Libxcb
sudo apt-get -y install "^libxcb.*" libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev
#Qt Webkit
sudo apt-get -y install flex bison gperf libicu-dev libxslt-dev ruby
#Qt WebEngine/Ubuntu (all)
#!/bin/sh
#do dos2unix if required
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
sudo apt-get -y autoclean
sudo apt-get -y clean
@jinahya
jinahya / add.bashrc
Last active August 29, 2015 14:21
selecting jdk and changing java_home
# finds and export JAVA_HOME
#export JAVA_HOME=$(dirname $(dirname $(readlink -e /usr/bin/javac)))
export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
simple string
@jinahya
jinahya / ..reading_large_numbers_in_jni
Last active August 29, 2015 14:22
An example reading a large native number into a BigInteger.
.
@jinahya
jinahya / reverse.c
Last active August 29, 2015 14:22
functions reserve an array
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int reverse(void * array, const size_t offset, const size_t length, const size_t size) {
void * temp = malloc(size);
if (temp == NULL) {
return EXIT_FAILURE;
}
@jinahya
jinahya / swap.c
Last active August 29, 2015 14:23
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define swapa(type, a, b) { type t = a; a = b; b = t; }
#define swapb(type, a, b) { type t = *a; *a = *b; *b = t; }
class ArrOffLen<T> {
public boolean isValid() {
if (arr == null) {
return false;
}
if (off < 0) {
return false;
}
if (len < 0) {