This file contains hidden or 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
app = Flask(__name__) | |
@app.route('/hello', methods=['GET']) | |
def say_hello(): | |
return 'hello' |
This file contains hidden or 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
@RequestMapping( | |
value = "/hello", method = GET) | |
@ResponseBody | |
public String getHelloMessage() { | |
return "hello"; | |
} |
This file contains hidden or 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 Main { | |
public static void main(String[] args) { | |
initApi(); | |
} | |
public static void initApi() { | |
port(8080); | |
get("/", MainResource::handleMain); | |
} |
This file contains hidden or 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
# ALIASES | |
## Kubernetes | |
alias kp="kubectl get po" | |
alias kl="kubectl logs" | |
alias ks="kubectl get logs" | |
## Docker | |
alias dk="docker" | |
alias dks="dk ps" | |
alias dksn="dks --format \"table {{.ID}}\t{{.Names}}\t'dkl {{.ID}}'\t'dke {{.ID}} bash'\"" | |
alias dki="dk images" |
This file contains hidden or 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.security.KeyPairGenerator; | |
import java.security.KeyPair; | |
import java.security.PrivateKey; | |
import java.security.PublicKey; | |
import java.security.KeyFactory; | |
import java.security.spec.EncodedKeySpec; | |
import java.security.spec.PKCS8EncodedKeySpec; | |
import java.security.spec.X509EncodedKeySpec; | |
import java.security.spec.InvalidKeySpecException; | |
import java.security.NoSuchAlgorithmException; |
This file contains hidden or 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
protocol::Note note = protocol::Note(); | |
string name = "Buy vegetable"; | |
string cafel = "-Apple\n-Pomodoro\n-Avocado"; | |
note.set_name(name); | |
note.set_content(cafel); | |
note.set_id(1); | |
note.set_type(protocol::NoteType::BASIC); | |
Envelope envelope = createEnvelope(¬e); | |
int size = envelope.ByteSize(); |
This file contains hidden or 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
Note note = Note.newBuilder() | |
.setName("But list") | |
.setContent("Buy:\n" | |
+ "- Beer\n" | |
+ "- Beef\n" | |
+ "- Bacon\n" | |
+ "- Leg for C++ client part") | |
.setId(((long) (Math.random() * 900000000))) | |
.setType(NoteType.BASIC).build(); | |
Envelope requesetEnvelope = Envelope.newBuilder().addNote(note).setType(Type.SAVE_NOTE).build(); |
This file contains hidden or 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
message Envelope { | |
enum Type { | |
GET_ALL_NOTES = 0; | |
SAVE_NOTE = 1; | |
DELETE_NOTE = 2; | |
} | |
Type type = 1; | |
int64 arrivalTime = 2; | |
int64 id = 3; |
This file contains hidden or 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
enum NoteType { | |
BASIC = 0; | |
REMINDER = 1; | |
SCRATCH = 2; | |
} | |
message Note { | |
int64 id = 1; | |
string name = 2; | |
int64 creationDate = 3; |
This file contains hidden or 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
@Aspect | |
public class PermissionAspect { | |
@Around("execution(@DangerousPermission void *(..))") | |
public void beforeDangerousMethod(ProceedingJoinPoint point) | |
throws Throwable { | |
Activity activity = ((ActivityHolder) point.getThis()).getActivity();//getting Activity | |
MethodSignature signature = (MethodSignature) point.getSignature(); | |
Method method = signature.getMethod(); | |
//Taking our required permission to check |