Skip to content

Instantly share code, notes, and snippets.

/*
-number: input number
-min: Minimun number
-max: Maximun number
given a number and a minimun a maximun
calculate the equivalent percentage
*/
float valtope(float number, float min, float max){
float res = ((number - min) / (max - min)) * 100;
return res;
mkdir ~/.go
echo "GOPATH=$HOME/.go" >> ~/.bashrc
echo "export GOPATH" >> ~/.bashrc
echo "PATH=\$PATH:\$GOPATH/bin # Add GOPATH/bin to PATH for scripting" >> ~/.bashrc
source ~/.bashrc
// Everyone knows passphrases. One can choose passphrases from poems, songs, movies names and so on but frequently they can be guessed due to common cultural references. You can get your passphrases stronger by different means. One is the following:
// choose a text in capital letters including or not digits and non alphabetic characters,
// shift each letter by a given number but the transformed letter must be a letter (circular shift),
// replace each digit by its complement to 9,
// keep such as non alphabetic and non digit characters,
// downcase each letter in odd position, upcase each letter in even position (the first character is in position 0),
// reverse the whole result.
@sebassdc
sebassdc / kport.js
Created January 28, 2017 08:00
A little script that kills the process that use a given port
#! /home/sebassdc/.nvm/versions/node/v6.9.1/bin/node
// place up there the output of "whereis node"
const cp = require('child_process')
if (process.argv.length < 3 || process.argv.length > 3) {
throw new Error('must be one argument')
}
cp.exec(`netstat -ap | grep :${process.argv[2]}`, (err, stdout, stderr) => {
if (err) {
@sebassdc
sebassdc / SumaMatriz.cpp
Last active February 24, 2017 04:39
clase-22-02
#include <iostream>
using namespace std;
void print_arr(int matriz[],int size) {
cout << "{";
for (int i = 0; i < size; i++) {
cout << matriz[i];
if (i < size - 1) cout << ", ";
}
cout << "}";
@sebassdc
sebassdc / ghh.cpp
Created February 26, 2017 05:26
Ahorra tiempo para compilar c++
// ahorra tiempo para compilar c++
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[]) {
string filename(argv[1]), result, callString;
result = filename.substr(0 , filename.length() - 4);
@sebassdc
sebassdc / passgen.py
Created February 26, 2017 05:30
Generate pseudosecure paswords CLI
#! /usr/bin/python
import sys
import random as rd
from string import ascii_lowercase as beta
from string import ascii_uppercase as alfa
def passgen(longu):
colection = ""
#! /usr/bin/python3
"""cliube
Usage:
cliube inverse <moves>
cliube optimise <moves>
cliube (-h | --help)
cliube --version
Options:
@sebassdc
sebassdc / Guia10.cpp
Created March 1, 2017 13:00
Resuelto en clase (propio) 01/03/2017
/* Guia 10
El Consejo Nacional Electoral, organismo encargado de realizar los procesos
electorales a nivel nacional, requiere conocer cierta informacion estadistica
del mes de mayo, respecto al numero de inscritos.
Dicho organismo desea cuantificar:
-> El numero de personas inscritas en el mes
-> El numero de personas inscritas cada una de las semanas del mes.
-> Y por ultimo desea determinar cual de los dias de inscripcion resulta mas
efectivo, es decir, reporta mayor cantidad de inscritos
-> Los datos suministrados son:
@sebassdc
sebassdc / Guia10_prof.cpp
Created March 1, 2017 13:02
Resuelto en clase (prof) 01/03/2017
/* Guia 10
El Consejo Nacional Electoral, organismo encargado de realizar los procesos
electorales a nivel nacional, requiere conocer cierta informacion estadistica
del mes de mayo, respecto al numero de inscritos.
Dicho organismo desea cuantificar:
-> El numero de personas inscritas en el mes
-> El numero de personas inscritas cada una de las semanas del mes.
-> Y por ultimo desea determinar cual de los dias de inscripcion resulta mas
efectivo, es decir, reporta mayor cantidad de inscritos
-> Los datos suministrados son: