Skip to content

Instantly share code, notes, and snippets.

View Ts-Pytham's full-sized avatar
🏠
Working from home

Johan Sánchez Ts-Pytham

🏠
Working from home
  • On my way...
View GitHub Profile
@Ts-Pytham
Ts-Pytham / pipes.c
Last active April 24, 2023 14:42
Envio de información (estructura) por varias tuberias
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <wait.h>
#include <time.h>
#define BUFFER 1024
/*
Hijo n
@Ts-Pytham
Ts-Pytham / pipes.c
Created April 24, 2023 14:16
Envio de información por varias tuberias
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <wait.h>
#include <time.h>
#define BUFFER 1024
/*
Hijo n
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
void *handler;
void funcHandler(int sig)
@Ts-Pytham
Ts-Pytham / partial_sum.c
Created April 17, 2023 05:10
Partial sum with pipes and fork
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
#include <time.h>
#include <signal.h>
#define TABLE_SIZE 10000
struct timespec start, end;
@Ts-Pytham
Ts-Pytham / Main.cpp
Created January 22, 2021 04:50
Algoritmo Congruencial aditivo en C++ usando la clase vector
#include <iostream>
#include "Random.hpp"
#include <vector>
using std::vector;
int main()
{
vector<int> vect;
int data;
for (int i = 0; i != 5; ++i) {
@Ts-Pytham
Ts-Pytham / Main.cpp
Created January 22, 2021 04:36
Algoritmo Congruencial Aditivo
#include <iostream>
#include "Random.hpp"
int main()
{
int* vect = new int[5];
for (int i = 0; i != 5; ++i) {
std::cin >> vect[i];
@Ts-Pytham
Ts-Pytham / Palindroma.cs
Created January 11, 2021 23:00
Función que calcula las palabras palíndromas
static bool Palindroma(string palabra)
{
palabra = palabra.Replace(" ", "");
palabra = palabra.ToLower();
int len = palabra.Length;
for(int i = 0; i != len - 1; ++i)
{
if (palabra[i] != palabra[len - 1])
return false;
len--;
@Ts-Pytham
Ts-Pytham / Fibonacci.cs
Created December 22, 2020 19:27
Sucesión de Fibonacci
using System;
using System.Numerics;
namespace Serie_de_Fibonacci
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Ingrese la posición para hallar el número de la sucesión de Fibonacci: ");
@Ts-Pytham
Ts-Pytham / ReplaceALL.CS
Last active April 13, 2020 03:41
ReplaceALL and RemoveALL C# By Ts-Pytham
using System;
namespace ReplaceALL
{
class Program
{
static string ReplaceAll(string str, string palabra_reemplazar, string palabra)
{
string aux = "", aux1 = "";
int len = str.Length, correcto = palabra_reemplazar.Length, j = 0;
@Ts-Pytham
Ts-Pytham / factorial.py
Created September 18, 2019 03:27
Sacar factorial en Python
a = int(input("Ingrese el numero:"))
factorial = 1
for i in range(1, a+1):
factorial = factorial*i
print(f"{i}! --> {factorial}")