Skip to content

Instantly share code, notes, and snippets.

View paolaguarasci's full-sized avatar
💭
I may be slow to respond.

Paola Guarasci paolaguarasci

💭
I may be slow to respond.
View GitHub Profile
@paolaguarasci
paolaguarasci / .zshrc
Last active February 22, 2022 11:19
config
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/home/paola/.oh-my-zsh"
# ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(zsh-peco-history z git history-substring-search colored-man-pages zsh-autosuggestions zsh-syntax-highlighting zsh-z archlinux mvn docker vscode docker-compose autojump dnf npm)
@paolaguarasci
paolaguarasci / findSubString.cpp
Created September 24, 2020 15:50
match stringhe
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int simpleStringMatching(string X, string Y);
int main() {
string a = "algoritmiestrutturedati";
string b = "est";
@paolaguarasci
paolaguarasci / maxsubseq.cpp
Created September 24, 2020 15:29
dimensione massima sotto sequenza
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int minVectorValue(vector<int> V);
int minVectorIndex(vector<int> V);
void stampaMatrice(vector<vector<int>>& v, int offset);
int sottoSequenzaMaxRic(string a, int, string b, int);
@paolaguarasci
paolaguarasci / distanza.cpp
Last active September 24, 2020 14:25
Distanza tra due stringhe
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int minVectorValue(vector<int> V);
int minVectorIndex(vector<int> V);
int distanza(string a, string b);
void stampaMatrice(vector<vector<int>>& v, int offset);
int main() {
@paolaguarasci
paolaguarasci / read-write-directory-to-json.js
Last active September 14, 2018 11:28
Write and Read Directory structure on JSON file
const fs = require("fs");
const path = require("path");
let nDir = 0;
let nFile = 0;
const result = [];
function read(p) {
let info = {
"type": "",
"name": "",
@paolaguarasci
paolaguarasci / cp.js
Created September 10, 2018 06:56
cp clone in js
// Clone copy script - cp command
// import that we need
const fs = require("fs");
// get command line arguments
const source = process.argv[2];
const destination = process.argv[3];
// check if source is directory
@paolaguarasci
paolaguarasci / ls.js
Last active September 10, 2018 06:56
ls clone in js
("use strict");
const path = require("path");
const fs = require("fs");
const moment = require("moment");
const posix = require("posix");
const color = require("colors");
let myPath = path.resolve(process.argv[2] || "./");
let result = [];
@paolaguarasci
paolaguarasci / rot13.js
Created August 17, 2018 09:28
Caesars Cipher
/*
JavaScript Algorithms and Data Structures Projects: Caesars Cipher
One of the simplest and most widely known ciphers is a Caesar cipher, also known as a shift cipher. In a shift cipher the meanings of the letters are shifted by some set amount.
A common modern use is the ROT13 cipher, where the values of the letters are shifted by 13 places. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on.
Write a function which takes a ROT13 encoded string as input and returns a decoded string.
All letters will be uppercase. Do not transform any non-alphabetic character (i.e. spaces, punctuation), but do pass them on.
Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher
*/
@paolaguarasci
paolaguarasci / convertToRoman.js
Created August 17, 2018 08:36
Roman Numeral Converter
/**
JavaScript Algorithms and Data Structures Projects: Roman Numeral Converter
Convert the given number into a roman numeral.
All roman numerals answers should be provided in upper-case.
Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/roman-numeral-converter/
*/
function convertToRoman(num) {
let digit = [];
@paolaguarasci
paolaguarasci / app.js
Created August 5, 2018 08:20
Smallest Common Multiple
function mcd(a,b) {
let r;
while (b > 0) {
r = a % b;
a = b;
b = r;
}
return a;
}