hacker

Teymour Aldridge

@CaptainAnon (142)
How to use the .env file?
posted to Ask by vedprad1

Within your .env file you can set environment variables, which is done in a KEY=VALUE format, e.g.

SECRET_KEY="hello_world!"
OTHER_SECRET_KEY=hello_world_again!

You should be able to use a programming language to manipulate environment variables. In python try:

import os
print(os.getenv('SECRET_KEY')) # Prints "hello_world!"
print(os.getenv('OTHER_SECRET_KEY')) # prints hello_world_again

In node.js

console.log(process.env.SECRET_KEY)) # Outputs "hello_world!"
console.log(process.env.OTHER_SECRET_KEY)) # Outputs hello_world_again

Note that quotation marks will be part of your environment variable (unlike in python or node.js where the interpreter assumes that this means your variable is a string). So H="H" means that h is assigned the value of "H" not H.

The .env file is hidden from other users, who cannot see it when they look at your repl. It is not included in forks that other users make of the repository.

Using MongoDB with python (using PyMongo)
posted to Tutorials by TheDrone7

I'd suggest storing the connection string inside a .env file, which prevents malicious people from being able to read and write data to your MongoDB cluster.
https://repl.it/site/docs/repls/secret-keys

Introducing Repl.it offline!

Do you accept telegrams or faxed documents?

Connecting repl.it to a GitHub repo?
posted to Ask by CaptainAnon

@triptych You can use the git command. Command (or control on windows) + Shift + P and then search for 'open shell.'

What is Your Programming Lanugage? :)
posted to Ask by yasin213

@AlephZero I like it too, except that compiling takes forever. You can also run into dependecy hell – Rust only allows one version of a native crate in a project and this can cause problems (for example you can't use the Rocket web framework with the jsonwebtoken framework without disabling Rocket's cookie features because Rocket uses a different version of ring (Rust's cryptography library, a lot of which is written in Assembly) than jsonwebtoken.

Introducing Repl.it offline!

@Xeoth I agree; the next step must surely be to obtain funding to build an automated warehouse for processing the overwhelming influx of code.

Database tips
posted to Tutorials by LiamDonohue

Autoescape user input before running it.

since I am in quarantine what should i make?
posted to Ask by xolyon

@sylashur I'm currently working on developing something like this.

Dictionary to respond to a question (python)
posted to Ask by rediar
question2answer = {
  # Fill this in with question and answer combinations
  'question': 'answer'
}
question = input("What is your question? ")
if question in question2answer:
  print(question2answer['question'])
else:
  print("I'm not sure how to respond to that question.")

If you're happy to not use dictionaries you could also try using a neural network to do this (probably a recurrent neural network)!

Connecting repl.it to a GitHub repo?
posted to Ask by CaptainAnon

@nik_safe If you create a new repl there is an option to enter a github.com URL.

Help me with this BNGG (BRUTAL NUMBER GUESSING GAME!!!)
posted to Ask by mkhoi

The python input() function by default returns a string. Because python cannot compare strings to integers you need to convert the value returned by the input function to an integer, so nump = int(input(">")).

What are the capabilities of what I can do with Python and how do I further my understanding?
posted to Ask by John_WardWard

Maybe the flask tutorial will help. Flask is a framework for building python web apps.

Why is the url not opening in python?
posted to Ask by Haruto121

The webdriver module opens the url requested in a browser window. The repl.it interface can't do that. Instead you could do this: https://repl.it/@CaptainAnon/Requests-Library-Demo

About the THAIL project
posted to Ask by xolyon

@StudentFires You can get an in-browser Python interpreter (DuckDuckGo "brython").

What is Your Programming Lanugage? :)
posted to Ask by yasin213

@AmazingMech2418 I don't know about libraries – I suspect that would be possible. The nature of stuff run in a web browser is that it doesn't have access to a file system – though I guess a virtual file system could be configured using IndexedDB and Fuse.

What is Your Programming Lanugage? :)
posted to Ask by yasin213

@AmazingMech2418 I reckon you could compile the Python interpreter to WebAssembly (it's mostly written in C) and then use it to run Python code on the web.

minimum difference pair
posted to Share by sabhishek78

Maybe use the built in sort method.
e.g. numbers.sort((a, b) => Math.abs(a[1] - a[0]) > Math.abs(b[1] - b[0]))

Mixed Language Repl?
posted to Ask by harperjohn

@Highwayman I just created one and realised that!

Mixed Language Repl?
posted to Ask by harperjohn

@Highwayman I always assumed Polygott was a language of itself :)

What is Your Programming Lanugage? :)
posted to Ask by yasin213

@AmazingMech2418 I disagree; despite the fact that Assembly Language is most commonly used by compiling another language into Assembly, assembling it and the running it, it's still used as a programing language.

WebAssembly is a turing-complete language with which you can program. Just because it is most commonly used with the help of a compiler (translating from a higher-level language, e.g. Rust, into a lower-level languagey) – exactly the same as Assembly – doesn't mean it isn't a language.

Even if I'm wrong and WebAssembly isn't a 'proper' language, the most important thing is that (a) it works and (b) you can build stuff that will run on the web in a programming language other than Javascript.

What is Your Programming Lanugage? :)
posted to Ask by yasin213

@AlephZero What do you make of Rust?

What is Your Programming Lanugage? :)
posted to Ask by yasin213

Rust and Fortran (preferably with implicit none).

What is Your Programming Lanugage? :)
posted to Ask by yasin213

@JadenGarcia Why doesn't WebAssembly count?

Mixed Language Repl?
posted to Ask by harperjohn

Yes. You can configure the command you want to run when you press the run button in your .replit file. You can configure this to build the C (and/or C++) libary as a Python extension module and then run a Python program.

I feel very behind in my knowledge of programming. Help?
posted to Ask by Eleamonthe

There's a lot of interesting books you might find useful:

Computing

Helpful maths books

  • The Calculus Lifesaver (Adrian Banner)
  • Mathematical Methods for the Physical Sciences (K. F. Riley, be careful, goes from explaininng the fundemental theorem of calculus to change of variables in multiple integrals in the first chapter – I think newer editions are a little better in this regards but the edition I have is from about 1980)
  • The Probability Lifesaver (Stephen Miller)

Fear not, none of these are affliate links.

How to encrypt and decrypt in node?
posted to Ask by ChezCoder

Maybe the built in crypto module would do the trick?

Can we make a new Programming Language
posted to Ask

@MrHackman I'd dispute that. I think there are much more tricky things; numerical computing (I'm including machine learning in this as well as the classic algorithms), networking and databases are pretty hard.

Phyton to html
posted to Ask by Bennieboy28

@Bennieboy28 I've updated it.

let leeft = Number(prompt("Hoe oud ben je "))
let punt1 = Number(prompt("hoevaak ben je gefriendzoned vanaf de middelbare school? LET OP! BLAUWTJES TIJDENS HET STAPPEN TELT NIET!!! "))
let punt2 = Number(prompt("hoevaak ben je eruit gekomen en dus een relatie met diegene gehad? "))
let punt3 = punt1 - punt2
let punt4 = punt3 + punt3
let punt5 = punt4 - punt3
let losertester = leeft/2 
let geenkneus = punt3 - leeft/2 
if (punt3 >=losertester) {
 alert('U bent een sukkel, u heeft ' + punt3 + ' peterpunten. Dat zijn er ' + geenkneus + ' te veel' )
}
if (punt3 <=losertester) {
  alert ('Gefeliciteerd u bent geen kneus u heeft '+ punt3 + ' peterpunten')
}
Phyton to html
posted to Ask by Bennieboy28

My solution (Repl):

let leeft = Number(prompt("Hoe oud ben je "))
let punt1 = Number(prompt("hoevaak ben je gefriendzoned vanaf de middelbare school? LET OP! BLAUWTJES TIJDENS HET STAPPEN TELT NIET!!! "))
let punt2 = Number(prompt("hoevaak ben je eruit gekomen en dus een relatie met diegene gehad? "))
let punt3 = punt1 - punt2
let punt4 = punt3 + punt3
let punt5 = punt4 - punt3
let losertester = leeft/2 
let geenkneus = punt3 - leeft/2 
if (punt3 >=losertester) {
 alert('U bent een sukkel, u heeft',punt3,'peterpunten. Dat zijn er',geenkneus,'te veel' )
}
if (punt3 <=losertester) {
  alert ('Gefeliciteerd u bent geen kneus u heeft',punt3,'peterpunten')
}

Javascript is a dynamic language (like Python) and is fairly similar.

I have a python version 2.7 project .How can I upload here and run and see all outputs?
posted to Ask by Dhruvsharma8

Just a note – Python 2.x was retired in January 2020 and is no longer supported.