Skip to content

Instantly share code, notes, and snippets.

@Kenji-H
Kenji-H / sample.py
Last active October 21, 2017 09:14
Signal Handler in Python
import signal
import time
def sigint_handler(num, frame):
print("received SIGINT!")
def sigtstp_handler(num, frame):
print("received SIGTSTP!")
@Kenji-H
Kenji-H / unit_sphere_sampler.ipynb
Created April 22, 2017 12:14
Unit Sphere Sampling
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Kenji-H
Kenji-H / gist:b36e112f2eb9a6b6eb57
Last active August 29, 2015 14:27
Python snippets
# remove empty element from list
x = [1,2,3,'',4,5,'']
filter(None, x)
# path exist check
import os
os.path.exists('/home/kenjih')
# create path string
import os
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.math.BigInteger.*;
import java.io.*;
import java.util.*;
@SuppressWarnings("unused")
public class B {
Scanner sc = new Scanner(System.in);
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.math.BigInteger.*;
import java.io.*;
import java.util.*;
@SuppressWarnings("unused")
public class A {
Scanner sc = new Scanner(System.in);
@Kenji-H
Kenji-H / AuthAction.java
Created February 9, 2013 14:47
openid4java with Struts DispatchAction
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;