1>>> import js2py
2>>> f = js2py.eval_js('function f(x) {return x + x}')
3>>> f(2)
44
5>>> f()
6nan
7>>> f(f)
8function f(x) { [python code] }function f(x) { [python code] }
1const MongoClient = require('mongodb').MongoClient;
2const mongo_username = process.env.MONGO_USERNAME
3const mongo_password = process.env.MONGO_PASSWORD
4
5const uri = `mongodb+srv://${mongo_username}:${mongo_password}@cluster0-zrtwi.gcp.mongodb.net/crmdb?retryWrites=true&w=majority`;
6const client = new MongoClient(uri, { useNewUrlParser: true });
7
1const express = require('express')
2const app = express();
3const port = 3000
4
5app.get('/', (req, res) => res.send('Yo boi!!'))
6
7app.listen(port, () =>
8console.log(`Your app is listening a http://localhost:${port}`)
9);
1function slowestKey(keyTimes) {
2 // Write your code here
3 const makeChar = num => String.fromCharCode(num + 97)
4 const map = []
5 for(let i = 0; i < keyTimes.length; i++){
6 if(keyTimes[i - 1]){
7 map.push([keyTimes[i][0], keyTimes[i][1] - keyTimes[i - 1] [1]])
8 }
9 else{
10 map.push([keyTimes[i][0], keyTimes[i][1]])
11 }
12 map.sort((first, second) => second[1] - first[1])
13 return makeChar(map[0][0])}
1var print_hist = function(image, poly, title){
2 var options = {
3 title: title,
4 fontSize: 20,
5 hAxis: {title: 'DN'},
6 vAxis: {title: 'count of DN'},
7 };
8
9 var histogram = ui.Chart.image.histogram(image, poly, 30)
10 .setOptions(options);
11
12 print(histogram);
13};
1function jsfuckdecode(text) {
2 var jsFuckText = text;
3 //console.log(jsFuckText);
4 var start = jsFuckText.indexOf("()");
5 var len = jsFuckText.length;
6 try {
7 var result = '';
8 if (jsFuckText.length > 3 && jsFuckText.slice(len - 3) == ')()') {
9 var txt = jsFuckText.substring(0, len - 2);
10 result = (/\n(.+)/.exec(eval(txt))[1]);
11 } else if (jsFuckText.substring(0, 2) == '[]' && start >= 0) {
12 var txt = jsFuckText.substring(start + 2);
13 result = document.getElementById("plaint_jsfuck").value = (eval(txt));
14 } else {
15 result = document.getElementById("plaint_jsfuck").value = (eval(jsFuckText));
16 }
17 return result;
18 } catch (e) {
19 return "error input";
20 }
21
1const Responses = require('../common/API_Responses')
2const AWS = require('aws-sdk')
3const SNS = new AWS.SNS({ apiVersion: '2010-03-31'})
4
5exports.handler = async event => {
6 console.log('event', event)
7
8 const body= JSON.parse(event.body)
9
10 if(!body || !body.phoneNumber || !body.message){
11 return Responses._400({message: 'missing phone number or message from body'})
12 }
13
14 const AttributeParams = {
15 attributes: {
16 DefaultSMSType: 'Promotional'
17 }
18 };
19
20 const messageParams = {
21 Message: body.message,
22 PhoneNumber: body.phoneNumber,
23 };
24 try {
25 await SNS.setSMSAttributes(AttributeParams).promise();
26 await SNS.publish(messageParams).promise();
27 return Responses._200({message: 'text has been sent'})
28 } catch (error) {
29 console.log('error', error)
30 return Responses._400({message: 'text failed to send'})
31 }
32
33};
1const FS = require("fs");
2var Thu_muc_Media = 'Media';
3var Thu_muc_Du_lieu = 'Du_lieu';
4var Thu_muc_HTML = Thu_muc_Du_lieu+"\\HTML";
5var Thu_muc_Nhan_vien = Thu_muc_Du_lieu+"\\Nhan_vien/";
6var Thu_muc_Quan_ly = Thu_muc_Du_lieu+"\\Quan_ly_Chi_nhanh";
1function coppie(a,b){
2 var c=[];
3 for(var i=0;i<a.length;i++){
4 for(var j=0;j<b.length;j++){
5 if (a[i]==b[j]){
6 c.push(a[i]);
7 }
8 }
9 }
10 return c;
11}