This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32 | |
global start | |
section .text | |
start: | |
push dword msg.len | |
push dword msg | |
push dword 1 | |
mov eax, 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Subject { | |
void request(); | |
} | |
class RealSubject implements Subject { | |
public void request() { | |
System.out.println("RealSubject"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Service { | |
//目标方法 | |
public abstract void add(); | |
} | |
class UserServiceImpl implements Service { | |
public void add() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UserServiceImpl { | |
public void add() { | |
System.out.println("This is add service"); | |
} | |
public void delete(int id) { | |
System.out.println("This is delete service?delete " + id); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyClassGeneratorByASM { | |
public static void main(String[] args) throws IOException { | |
System.out.println(); | |
ClassWriter classWriter = new ClassWriter(0); | |
// 通过visit方法确定类的头部信息 | |
classWriter.visit(Opcodes.V1_7,// java版本 | |
Opcodes.ACC_PUBLIC,// 类修饰符 | |
"Programmer", // 类的全限定名 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyClassGeneratorByJavassist { | |
public static void main(String[] args) throws Exception { | |
ClassPool pool = ClassPool.getDefault(); | |
//创建Programmer类 | |
CtClass cc= pool.makeClass("com.samples.Programmer"); | |
//定义code方法 | |
CtMethod method = CtNewMethod.make("public void code(){}", cc); | |
//插入方法代码 | |
method.insertBefore("System.out.println(\"I'm a Programmer,Just Coding.....\");"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=/usr/bin/clang | |
NAME=im-select | |
INSTALL_PATH=/usr/local/bin/ | |
OPTS=-framework foundation -framework carbon | |
all: | |
$(CC) $(OPTS) -o $(NAME) $(NAME).m | |
install:$(NAME) | |
cp $(NAME) $(INSTALL_PATH) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* $Id$ | |
* | |
* Licensed to the Apache Software Foundation (ASF) under one | |
* or more contributor license agreements. See the NOTICE file | |
* distributed with this work for additional information | |
* regarding copyright ownership. The ASF licenses this file | |
* to you under the Apache License, Version 2.0 (the | |
* "License"); you may not use this file except in compliance | |
* with the License. You may obtain a copy of the License at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo use function hello | |
hello() | |
{ | |
echo how many parameters in the function:$#; | |
echo what parameters in the function $@; | |
echo the name of this function is $0; | |
echo the first parameters is :$1; | |
echo the second parameters is :$2; | |
echo the second parameters is :$3; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import java.security.CodeSource; | |
import java.security.ProtectionDomain; | |
/** | |
* Creted on 2018/2/8. | |
*/ | |
public class TestGetClassFromWhichJarLocation { |
OlderNewer