Skip to content

Instantly share code, notes, and snippets.

View canujohann's full-sized avatar

johann canu canujohann

  • Axa Life Insurance
  • Tokyo
View GitHub Profile
@canujohann
canujohann / create-new-user-new-table.sql
Created August 25, 2014 01:52
Create new user / DB in sql
```
CREATE DATABASE invoice;
CREATE USER 'invoice'@'localhost' IDENTIFIED BY 'invoice';
GRANT ALL PRIVILEGES ON invoice . * TO 'invoice'@'localhost';
FLUSH PRIVILEGES;
```
@canujohann
canujohann / help.java
Last active August 29, 2015 14:04
android-db-helper
package com.example.alartest.DB;
import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* SQLiteOpenHelper helper
* @author canu
@canujohann
canujohann / data-structures.md
Last active October 15, 2015 08:06
Data structures

ArrayList

public class MyList<E> {

  private int size = 0;
  private static final int DEFAULT_CAPACITY = 10;
  private Object elements[];
  
  public MyList() {

RPM notes

Install

#Install an RPM Package
rpm -ivh pidgin-2.7.9-5.el6.2.i686.rpm

#Install a RPM Package Without Dependencies
rpm -ivh --nodeps BitTorrent-5.2.2-1-Python2.4.noarch.rpm
<form accept-charset="UTF-8" action="/api" method="post">
  <input id='{"amount": 100, "credit_card": { "number": "4111111111111111", "expiry": "2018-04-11"}}' name="json" type="hidden" />
  <input name="commit" type="submit" value="送信!" />
</form>
@canujohann
canujohann / ruby-block-error.md
Last active August 29, 2015 14:03
謎のエラー
class Settlement
    
    attr_reader :url, :parameters
    
    def initialize(&block)
      instance_eval block.call
    end
 
@canujohann
canujohann / tomcat-apache-access-check.md
Last active October 15, 2015 08:24
tomcat・apache:アクセス計測

tomcat・apache:アクセス計測

bashの基本コマンドで日付順でリストアップして、ユニックでまとめる:

awk '{print $4}' /your_log_file.log | cut -d: -f1 | sort | uniq -c | tr -d "["

crontabに入れて、自動的に送りましょう:

@canujohann
canujohann / struts-1-avoid-jsp-access.md
Last active August 29, 2015 14:02
Struts 1 : avoid direct access to JSP

avoid direct access to JSP

Avoid direct access to JSP in put JSP files into the web/src/class, or add the below code to your web.xml file:

<security-constraint> 

  <web-resource-collection> 
    <web-resource-name>Deny Direct Access</web-resource-name> 
  
@canujohann
canujohann / open-ssl-update.md
Created June 9, 2014 07:03
open-ssl : update (centos)

Upate openSSL

# check current version
yum list installed | grep openssl

# check if update is available
yum list updates | grep openssl

#update
@canujohann
canujohann / generics-in-java.md
Last active August 29, 2015 14:02
Generics in java
public class MainClass {

	public static void main(String args[]) {

		Holder<Duck> myDuck = new Holder<Duck>(new Duck());
		myDuck.behaviour();

		Holder<Dog> myDog = new Holder<Dog>(new Dog());
 myDog.behaviour();