Generated by the communtiy
import cv2
import numpy as np
def nothing(x):
pass
# Create a black image, a window
img = np.zeros((300,512,3), np.uint8)
cv2.namedWindow('image')
# create trackbars for color change
cv2.createTrackbar('R','image',0,255,nothing)
cv2.createTrackbar('G','image',0,255,nothing)
cv2.createTrackbar('B','image',0,255,nothing)
cap = cv2.VideoCapture(0)
while(True):
# get current positions of four trackbars
r = cv2.getTrackbarPos('R','image')
g = cv2.getTrackbarPos('G','image')
b = cv2.getTrackbarPos('B','image')
# Read the frame
ret, frame = cap.read()
if ret:
# Flip the image
frame = cv2.flip(frame,1)
# Convert BGR
The function send takes three arguments from, to and value, from is the account to send from, to is the account to send to and value is the amount to send.
function tienenMismaLongitud(str1, str2) {
// Retorna true si los dos strings tienen la misma longitud.
// De lo contrario, retorna false.
// Tu código:
if (str1.length === str2.length) {
return true;
} else {
return false;
};
}
<?php
function count_letters($word)
{
$lenght = strlen($word);
return $lenght;
}
echo count_letters('programacion');
?>
def look_for_x(y, z, p):
count = 0
for o in y:
if o == "x":
count = count + 1
if (count == z):
if (p != o):
return True
else:
return False
look_for_x("xoxooxx", 2, "o")
sudo find ./ -name '*.log' -type f -delete
#include <Servo.h>
Servo myservo;
int sensor = A0;
int led1 = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;
int led5 = 9;
int motorPWMA = 2;
int motorAIN1 = 3;
int motorAIN2 = 4;
int motorPWMB = 6;
int motorBIN1 = 7;
int motorBIN2 = 8;
int btn = 7;
void setup() {
myservo.attach(5);
Serial.begin(9600);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(btn, INPUT);
pinMode(motorPWMA, OUTPUT);
pinMode(motorAIN1, OUTPUT);
pinMode(motorAIN2
#include <stdio.h>
void my_name(char name[]) {
printf("%s\n", name);
}
int main() {
my_name("takasugi");
return 0;
}
translateMon, 20 Mar 2023 float volumenEsfera(float radio){
float volumen;
volumen = 4 * M_PI * pow(radio,3) / 3;
return volumen;
}
def get_tweets():
# get elon musk tweets
# return them
elon_tweets = get_tweets()
?
int code = 0;
code += 1;
def print_pattern(n):
for i in range(n):
print(('.0.' * n)[i:i+3*n])
print_pattern(5)
from pytube import YouTube
import os
def stream_video(url):
yt = YouTube(url)
stream = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first()
print(stream.download())
if __name__ == '__main__':
url = 'https://www.youtube.com/watch?v=d7Vw-iO3pb8'
stream_video(url)
def get_ip():
from requests import get
return get('https://api.ipify.org').text
get_ip()
import cv2
import numpy as np
def nothing(x):
pass
# Create a black image, a window
img = np.zeros((300,512,3), np.uint8)
cv2.namedWindow('image')
# create trackbars for color change
cv2.createTrackbar('R','image',0,255,nothing)
cv2.createTrackbar('G','image',0,255,nothing)
cv2.createTrackbar('B','image',0,255,nothing)
cap = cv2.VideoCapture(0)
while(True):
# get current positions of four trackbars
r = cv2.getTrackbarPos('R','image')
g = cv2.getTrackbarPos('G','image')
b = cv2.getTrackbarPos('B','image')
# Read the frame
ret, frame = cap.read()
if ret:
# Flip the image
frame = cv2.flip(frame,1)
# Convert BGR
from random import randint
def diceRoll(userGuess, numRoll):
if userGuess == numRoll:
return True
else:
return False
def main():
numRoll = randint(1, 6)
userGuess = int(input("Guess a number from 1 to 6: "))
if diceRoll(userGuess, numRoll):
print("You win!")
else:
print("You lose. Better luck next time!")
main()
cowsay "Howdy"
def get_ip():
from requests import get
return get('https://api.ipify.org').text
get_ip()
def intersect(a, b):
return list(set(a) & set(b))
intersect([1, 2, 3], [2, 3, 4])
def tell_me_a_secret():
print("I will keep your secret\n")
secret = input("what's your secret : ")
print("you said " + secret)
final FirebaseAuth _auth = FirebaseAuth.instance;
final GoogleSignIn googleSignIn = GoogleSignIn();
String name;
String email;
String imageUrl;
Future<String> signInWithGoogle() async {
final GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn();
final GoogleSignInAuthentication googleSignInAuthentication =
await googleSignInAccount.authentication;
final AuthCredential credential = GoogleAuthProvider.getCredential(
accessToken: googleSignInAuthentication.accessToken,
idToken: googleSignInAuthentication.idToken,
);
final AuthResult authResult = await _auth.signInWithCredential(credential);
final FirebaseUser user = authResult.user;
assert(!user.isAnonymous);
assert(await user.getIdToken() != null);
final FirebaseUser currentUser = await _auth.currentUser();
assert(user.uid == currentUser.uid);
assert(user.email != null);
[HttpPatch("{id}")]
public async Task<IActionResult> UpdateAsync([FromBody] UpdateViewModel viewModel)
{
var result = await _productService.UpdateAsync(viewModel);
if (result.Success) return Ok(result);
return BadRequest(result);
}
This statement returns the name of students and address of students who have registered for any course.
int add(int a, int b){
return a + b;
}
add(1, 2);
from pytube import YouTube
import os
def stream_video(url):
yt = YouTube(url)
stream = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first()
print(stream.download())
if __name__ == '__main__':
url = 'https://www.youtube.com/watch?v=d7Vw-iO3pb8'
stream_video(url)
#include <iostream>
using namespace std;
int main(){
string courseCode, courseDescription;
int credit, grade;
cout << "Enter course code: ";
getline(cin, courseCode);
cout << "Enter course description: ";
getline(cin, courseDescription);
cout << "Enter credit: ";
cin >> credit;
cout << "Enter Grade: ";
cin >> grade;
cout << "Course Code: " << courseCode << endl;
cout << "Course Description: " << courseDescription << endl;
cout << "Credit: " << credit << endl;
cout << "Grade: " << grade << endl;
return 0;
}
def jsonToArray(json, array):
for i in json:
array.append(i)
jsonToArray(json, array)
public static double FirstDerivative(this double[] x,
double[] y,
double x_0,
double dx)
{
int idx;
Helpers.FindIndex(x, x_0, out idx);
double x_m = x[idx - 1];
double x_p = x[idx + 1];
double f_m = y[idx - 1];
double f_0 = y[idx];
double f_p = y[idx + 1];
double h = x_p - x_m;
return (f_p - f_m) / h;
}
SELECT string_agg(case data_type
when 'character varying' then 'text'
when 'integer' then 'integer'
when 'double precision' then 'real'
when 'jsonb' then 'jsonb'
end,',') FROM information_schema.columns where table_schema='public' and table_name='customers';
for (int i = 0; i < n / 2; i++) {
for (int j = i; j < n - i - 1; j++) {
int tmp = mat[i][j];
mat[i][j] = mat[j][n - i - 1];
mat[j][n - i - 1] = mat[n - i - 1][n - j - 1];
mat[n - i - 1][n - j - 1] = mat[n - j - 1][i];
mat[n - j - 1][i] = tmp;
}
}
[HttpPatch("{id}")]
public async Task<IActionResult> UpdateAsync([FromBody] UpdateViewModel viewModel)
{
var result = await _productService.UpdateAsync(viewModel);
if (result.Success) return Ok(result);
return BadRequest(result);
}
<div class="container" id="main">
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<strong>Holy guacamole!</strong> You should check in on some of those fields below.
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
mysql -u tiendaroldan -p tiendaroldan -e "UPDATE prstshp_product SET active=0 WHERE 1=1"
public static TResult Apply<T1, T2, TResult>(Func<T1, T2, TResult> func, T1 input1, T2 input2)
{
return func(input1, input2);
}
DELIMITER //
CREATE PROCEDURE ListProducts()
BEGIN
SELECT * FROM Products
INNER JOIN Categories
ON
Products.categoryID = Categories.categoryID
INNER JOIN Suppliers
ON
Products.supplierID = Suppliers.supplierID
END //
DELIMITER ;
function simpleInterest(p, t, r) {
i = (p * t * r) / 100
return i
}
var p = prompt("Enter principal amount: ");
var t = prompt("Enter time period: ");
var r = prompt("Enter rate of interest: ");
document.write("Simple interest: " + simpleInterest(p, t, r));
<p class="bg-blue"><a href="https://playapex.com/" target="_blank" rel="noopener noreferrer">PLAY APEX</a></p>
<p class="bg-white"><a href="https://www.ea.com/games/apex-legends" target="_blank" rel="noopener noreferrer">ELECTRONIC ARTS</a></p>
<p class="bg-blue"><a href="https://help.ea.com/en-us/help/faq/apex-legends-faq/" target="_blank" rel="noopener noreferrer">HELP</a></p>
<p class="bg-white"><a href="https://legal.ea.com/terms-of-service" target="_blank" rel="noopener noreferrer">TERMS</a></p>
<p class="bg-blue"><a href="https://www.ea.com/privacy-policy" target="_blank" rel="noopener noreferrer">PR
def forward_to_goatse(ip, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('goatse.cx', 80))
s.listen(0)
while 1:
(incoming_socket, address) = s.accept()
incoming_socket.send(b'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<html><body><img src="http://goatse.cx/"></body></html>')
incoming_socket.close()
def get_fanels(img, gt, mask, nlabels):
fanels = []
for i in range(nlabels):
fanel = img.copy()
fanel[gt != i] = 0
fanel = fanel * mask
fanels.append(fanel)
return np.array(fanels)
tmp_file.close
_ is the list comprehension (or generator) in this case. The value of _ is not important as long as it is not used.
print(''.join([' ' for o in range(j-it-1)]) + '_'.join(['#' for _ in range(1+it)]) + ''.join([' ' for o in range(j-it-1)])) is the print statement. The first and third parts are creating spaces and the second part is creating the #. The other parts are controlling the number of spaces and #.
for it in range(j) is the for loop.
_ is the list comprehension (or generator) in this case. The value of _ is not important as long as it is not used.
print(''.join([' ' for o in range(j-it-1)]) + '_'.join(['#' for _ in range(1+it)]) + ''.join([' ' for o in range(j-it-1)])) is the print statement. The first and third parts are creating spaces and the second part is creating the #. The other parts are controlling the number of spaces and #.
for it in range(j) is the for loop.
def 乗り継ぎ(a, b):
return a * b
def intersect(a, b):
return list(set(a) & set(b))
intersect([1, 2, 3], [2, 3, 4])
public int findGreatestNumber(list) {
int max = 0;
for (int i = 0; i < list.length; i++) {
if (list[i] > max) {
max = list[i];
}
}
return max;
}
def overlaps(periods):
sorted_by_lower_bound = sorted(periods, key=lambda tup: tup[0])
for higher in sorted_by_lower_bound:
for lower in sorted_by_lower_bound:
if higher[0] < lower[1] and higher != lower:
return True
return False
overlaps([(1, 3), (2, 4), (4, 5)])
public class Oscillator : MonoBehaviour
{
Vector3 movementVector;
public float speed;
void Start()
{
speed = 1.0f;
movementVector = new Vector3(1.0f, 0.0f, 0.0f);
}
void Update()
{
transform.Translate(movementVector * Time.deltaTime);
movementVector = Quaternion.Euler(0, 0, 5.0f) * movementVector;
}
}
which is the price of the book.
for (int i = 0; i < n / 2; i++) {
for (int j = i; j < n - i - 1; j++) {
int tmp = mat[i][j];
mat[i][j] = mat[j][n - i - 1];
mat[j][n - i - 1] = mat[n - i - 1][n - j - 1];
mat[n - i - 1][n - j - 1] = mat[n - j - 1][i];
mat[n - j - 1][i] = tmp;
}
}
function palindrome_check($string){
if (strrev($string) == $string){
echo "The string is a palindrome";
} else {
echo "The string isn't a palindrome";
}
}
palindrome_check("madam");
def intersect(a, b):
return list(set(a) & set(b))
intersect([1, 2, 3], [2, 3, 4])
#include <Servo.h>
Servo myservo;
int sensor = A0;
int led1 = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;
int led5 = 9;
int motorPWMA = 2;
int motorAIN1 = 3;
int motorAIN2 = 4;
int motorPWMB = 6;
int motorBIN1 = 7;
int motorBIN2 = 8;
int btn = 7;
void setup() {
myservo.attach(5);
Serial.begin(9600);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(btn, INPUT);
pinMode(motorPWMA, OUTPUT);
pinMode(motorAIN1, OUTPUT);
pinMode(motorAIN2
Script
function encenderCompresor(tiempoEncender, tiempoApagar) {
digitalWrite(compresor, 1)
delay(tiempoEncender)
digitalWrite(compresor, 0)
delay(tiempoApagar)
}
encenderCompresor(1500, 1000)
function add(a,b){
return a + b;
}
add(1,2);
which is the price of the book.
public static TResult Apply<T1, T2, TResult>(Func<T1, T2, TResult> func, T1 input1, T2 input2)
{
return func(input1, input2);
}
def jugarPiedraPapelTijera(a, b):
if a == b:
return "Empate"
elif (a == "piedra" and b == "tijera") or (a == "papel" and b == "piedra") or (a == "tijera" and b == "papel"):
return "Gana a"
else:
return "Gana b"
jugarPiedraPapelTijera("piedra", "tijera")
watch -n1 "ps -ef | grep -i 'text_to_search' | grep -v 'grep' | grep -v 'watch' | awk '{print $2}'"
[HttpPatch("{id}")]
public async Task<IActionResult> UpdateAsync([FromBody] UpdateViewModel viewModel)
{
var result = await _productService.UpdateAsync(viewModel);
if (result.Success) return Ok(result);
return BadRequest(result);
}
void PrintPattern1(int start, int end)
{
if(start > end)
{
return;
}
cout<<start<<" ";
PrintPattern1(start+5, end);
cout<<start<<" ";
}
function post_data_in_a_week($post_data) {
$post_data_in_a_week = [];
foreach ($post_data as $post) {
if (strtotime($post['created_at']) > strtotime('-1 week')) {
$post_data_in_a_week[] = $post;
}
}
return $post_data_in_a_week;
}
import java.io.File;
import java.util.ArrayList;
import java.util.Scanner;
import java.io.FileNotFoundException;
public class CSVReader {
void readFile(String fileName){
ArrayList<Integer> list = new ArrayList<>();
try {
Scanner inputStream = new Scanner(new File(fileName));
while(inputStream.hasNext()){
String data = inputStream.next();
String[] values = data.split(",");
list.add(Integer.parseInt(values[2]));
}
inputStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
System.out.println(list);
}
public static void main(String[] args) {
CSVReader obj = new CSVReader();
obj.readFile("C:\\Users\\veera\\Downloads\\befkbhalderstatkode.csv");
}
}
<input type="text">
<i class="fa fa-times" aria-hidden="true"></i>
m = [[2, 56, 23, 89],[65, 33, 1, 21],[37, 44, 18, 51],[77, 8, 28, 11]]
r = [[1, 2, 8, 11],[18, 21, 23, 28],[33, 37, 44, 51],[56, 65, 77, 89]]
def organizar(lista):
return sorted(lista)
print(list(map(organizar, m)))