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
| pragma solidity >=0.7.0 <0.9.0; | |
| interface cETH { | |
| // define functions of COMPOUND we'll be using | |
| function mint() external payable; // to deposit to compound | |
| function redeem(uint redeemTokens) external returns (uint); // to withdraw from compound | |
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 WebSocket from 'ws'; | |
| const ws = new WebSocket('wss://ftx.com/ws/'); | |
| let ping; | |
| function open() { | |
| ws.on('open', function open() { | |
| ws.send(JSON.stringify({ | |
| op: 'subscribe', | |
| channel: 'ticker', | |
| market: 'BTC-PERP' |
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
| async function digestMessage(message) { | |
| const encoder = new TextEncoder(); | |
| const data = encoder.encode(message); | |
| const hash = await crypto.subtle.digest('SHA-256', data); | |
| return hash; | |
| } | |
| function toHexString(byteArray) { | |
| return Array.from(byteArray, function(byte) { | |
| return ('0' + (byte & 0xFF).toString(16)).slice(-2); |
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
| function receiveMessage(id, text) | |
| { | |
| let state = redis.get(id); | |
| if (state === "expecting default selection") processDefaultSelection(id, text) | |
| else if (state == "expecting location") processLocationResponse(id, text) | |
| else if (state === "expecting quantity") processQuantityResponse(id, text) | |
| else sendDefaultMessage(id); // first message from user or user is in no state | |
| } |
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
| const request = require('request-promise'); | |
| const environment = "staging"; | |
| const t_config = { | |
| oauth: { | |
| consumer_key: process.env.TWITTER_CONSUMER_KEY, | |
| consumer_secret: process.env.TWITTER_CONSUMER_SECRET, | |
| token: process.env.TWITTER_ACCESS_TOKEN, | |
| token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET | |
| } |
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
| /* ************************************************************************** */ | |
| /* */ | |
| /* ::: :::::::: */ | |
| /* sudoku.c :+: :+: :+: */ | |
| /* +:+ +:+ +:+ */ | |
| /* By: jiwok <[email protected]> +#+ +:+ +#+ */ | |
| /* +#+#+#+#+#+ +#+ */ | |
| /* Created: 2019/07/20 20:00:06 by jiwok #+# #+# */ | |
| /* Updated: 2019/07/20 21:18:15 by jiwok ### ########.fr */ | |
| /* */ |
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
| overwrite(id, obj) { | |
| client.del(`${id}-creation`, () => { | |
| client.HMSET(`${id}-creation`, obj) | |
| }) | |
| }, | |
| update(id, obj) { | |
| client.HMSET(`${id}-creation`, obj) | |
| }, |
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
| const http = require("http"); | |
| const https = require("https"); | |
| const AWS = require('aws-sdk'); | |
| const formidable = require("formidable"); | |
| const uuid = require("uuid"); | |
| let server = http.createServer(launch); | |
| let s3 = new AWS.S3({ | |
| // s3 credentials | |
| }); |
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
| sanitizePhoneNumber(phone, ext, errh) { | |
| errh = errh || function() {}; | |
| if(typeof phone !== "string" && !(phone instanceof String)) { | |
| errh("Phone number should be a string, "+(typeof phone)+" passed."); | |
| return false; | |
| } | |
| if (phone.charAt(0) === "+") phone = phone.substring(1); | |
| if (isNaN(Number(phone))) { | |
| errh ("Phone number contains non-numeric characters"); |
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
| else if (path === "invites/accept") { | |
| if (!session.uid) { | |
| response.write(sessionErrorMessage); | |
| return response.end(); | |
| } | |
| let status = yield db.collection("groups_members").insert({uid: session.uid, groupID: data.groupID, timestamp: new Date()}); | |
| if (!status.result.ok) { | |
| response.write('{"status": 500, "message": "Oops! An error occurred while adding you to group. Please try again."}'); | |
| return response.end(); | |
| } |
NewerOlder