Skip to content

Instantly share code, notes, and snippets.

View liweinan's full-sized avatar
🐢

阿男 liweinan

🐢
View GitHub Profile
@ams10961
ams10961 / gist:9968111
Last active December 10, 2015 11:54
RestEasy CORS Options Handler to allow cross-site scripting; probably JBoss specific.
package com.example.rest;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import org.jboss.resteasy.spi.DefaultOptionsMethodException;
@danbev
danbev / gist:3938238
Created October 23, 2012 11:13
RestEasy Programmatic Configuration

Programmatic endpoint configuration in RestEasy

This section will try to sort out the best way to implement programmatic endpoint configuration. The approach taken is to make as few changes as possible to RestEasy, which is means that when changes were required whole methods have been copied and those new methods changed were possible.

The following branch contains the code discussed in this document: programmatic-config

Lets starting with a very basic POJO like this:

public class Pojo
{
   public String doit()
@milenkovicm
milenkovicm / WarSmokeTest.java
Created March 14, 2012 11:42
[Junit] Arquillian - how to export shrinkwrap archive
@RunWith(Arquillian.class)
public class WarSmokeTest {
@Deployment
public static Archive<?> createTestArchive() {
final MavenDependencyResolver resolver = DependencyResolvers.use(MavenDependencyResolver.class).loadMetadataFromPom("pom.xml");
final WebArchive archive = ShrinkWrap.create(WebArchive.class)
.addAsWebInfResource("META-INF/beans.xml")
///
@chris-79
chris-79 / arch-linux-on-raspberry-pi.md
Last active June 8, 2018 11:56
Installing Arch Linux on Raspberry Pi
@alum
alum / binarytree.py
Created February 24, 2012 17:20
Binary tree in python
class BinaryNode:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
class BinaryTree:
''' A Binary Tree class '''
def __init__(self):
self.root = None
  1. download OpenEmu-Experimental
  2. download BIOS package
  3. unarchive bios package
  4.  duplicate `SCPH5552.BIN` and rename it to `SCPH5501.BIN`
    
  5. open Finder and press CMD + SHIFT + G
  6. fill in with ~/Library/Application Support/OpenEmu and hit Enter
  7. open the BIOS folder, if it's not, create it.
  8. copy SCPH5500.BIN, SCPH5501.BIN, SCPH5502.BIN from the BIOS package folder you downloaded earlier.
  9. open OpenEmu.
  10. select Sony PlayStation from the left pane
/**
* execute shell script
*/
private static void executeScript() {
	try {
	    String bash = "/bin/bash";
	    String script = "script.sh";
	    String[] command = { bash, script };
	
@tterem
tterem / generate.key.sh
Created April 18, 2019 09:07
Generate keystores for RESTEasy client ssl tests
#!/bin/bash
PASS="123456"
DN_SERVER="server"
DN_CLIENT="client"
VALIDITY=10000
DIR=$1
HOST="localhost"
cd ${DIR}
@maecapozzi
maecapozzi / create-react-app.md
Created December 12, 2017 15:28
Cheat Sheet for create-react-app
  1. Install create-react-app globally npm install -g create-react-app

  2. Create a new application create-react-app <name-of-application>

  3. Run server npm start inside of the applications directory.

@prehensilecode
prehensilecode / vboxmanage_cheat_sheet.txt
Last active October 18, 2019 02:00
VirtualBox commandline cheat sheet
# start a guest in headless mode
vboxmanage startvm guestvmname --type headless
# add a nic (number 2) to guest, setting it to be on the host-only network, and make it a virtio device
vboxmanage modifyvm guestvmname --nic2 hostonly --nictype2 virtio --hostonlyadapter2 vboxnet0
# remove nic number 2
vboxmanage modifyvm guestvmname --nic2 none
# turn on host i/o cache - needed for the virtual disk on ext4 on older kernels