Skip to content

Instantly share code, notes, and snippets.

View duytai's full-sized avatar

Tai D. Nguyen duytai

View GitHub Profile
interface Node {
_id: ID!
}
type User implements Node {
_id: ID!
name: String
}
type Book implements Node {
type Query {
me: User
node(_id: ID!): Node
nodes(_ids: [ID!]!): [Node]!
}
type User implements Node {
id: ID!
name: String
books(first: Int, last: Int, before: String, after: String): BookConnection
type CreateBookPayload {
book: Book
}
type CreateMusicPayload {
music: Music
}
input CreateBookInput {
_id: ID!
type Book implements Node {
_id: ID!
name: String
authors: [User]
pages(first: Int, last: Int, before: String, after: String): PageConnection
}
// graphql definition for User
type User implements Node {
_id: ID
name: String
friends: [User]
}
// implement
import { Users} from '/imports/models'
class Node {
constructor(node) {
@duytai
duytai / Config1.js
Last active September 8, 2017 02:52
{
"PT":1,
"TN":1,
"epsilon":1,
"ALPHA":1,
"BETA":1,
"GAMMA":1,
// apps property contains a list of applications. In this scenario, there is only one application
"apps":[
// appIndex = 0

1 - Get an Ubuntu machine up and running (make sure ports 11011 and 4000 are open)

2 - Install docker + docker-compose (full_install_docker_compose.sh)

3 - Get a docker-compose.yml with mongodb, kadira-ui, kadira-engine and kadira-rma (docker-compose.yml)

3 - Run "sudo docker-compose up" (-d if you want it running on background)

4 - Access http://machineIp:4000 and login as "admin@gmail.com" and "admin" password

5 - Create your APP, get the ID and Secret

6 - Setup kadira in your app by code or settings.json (Config)

7 - Update your app from "free" plan to "paid" to get full access at Kadira ([Update App Plan](https://gist.github.com/6uimorais/1e1de20bbbb2a04fe19fc73f88d6a25f#file-changepl

@duytai
duytai / victim.sol
Last active December 3, 2018 07:43
pragma solidity ^0.4.24;
contract Victim {
// gasless send error
function withdraw0(uint n, address addr) payable {
require(address(addr).send(n));
}
// reentrancy
function withdraw1(uint n) payable {
msg.sender.call.value(n)();
pragma solidity ^0.4.2;
contract Attacker {
bytes data = "";
uint count = 0;
address victim = 0xf1;
function() payable {
count ++;
if (count < 2) {
sudo apt-get install libleveldb-dev
find ../storage/ -printf "%T@ %Tc %p\n" | sort | head -100 | awk '{print $7}' | xargs cp -t .