Skip to content

Instantly share code, notes, and snippets.

View leopolicastro's full-sized avatar

Leo Policastro leopolicastro

View GitHub Profile
@leopolicastro
leopolicastro / numberGuessingGame.js
Last active March 20, 2023 21:55
Number Guessing Game
// Declare our variables
const prompt = require('readline-sync');
let maxGuesses = 3;
let currentGuess = 0;
const maxRange = 10;
// Generate random number
let randomNumber = Math.floor(Math.random() * maxRange + 1);
// console.log('Random number: ', randomNumber);
// Get user name
@leopolicastro
leopolicastro / url_parser.rb
Created December 2, 2018 16:39
url_parser
class UrlParser
def initialize(new_url)
@new_url = new_url
end
def scheme
scheme = @new_url.split('://')[0]
end
// 2. Fill in the missing line:
// return the index of the minimum element in an array -- find minimum value in array and return index
// [2, 4, 1, 5]
function minValueIndex(array) {
var min_index = -1;
var min_value = 0;
for (var i = 0; i < array.length; ++i) {
if (array[i] < min_value || min_index == -1) {
min_index = i;
min_value = array[i];
RSpec.configure do |config|
config.color = true
config.formatter = 'doc'
end
it 'Chrome is installed!' do
chrome_search = `which google-chrome`
expect(chrome_search).to_not be_empty, "Chrome isn't installed."
end
RSpec.configure do |config|
config.color = true
config.formatter = 'doc'
end
def lsregister_grep(search)
`/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/\
lsregister -dump | grep -i "#{search}"`
end
@import url('https://fonts.googleapis.com/css?family=Nunito+Sans:300,300i,700,700i&subset=latin-ext,vietnamese');
@import url('https://fonts.googleapis.com/css?family=Open+Sans%7CRajdhani&display=swap');
body{
font-family: "Open Sans" !important;
background-image: url('https://leo.nyc3.digitaloceanspaces.com/wynassets/wyncode-logo-blue.png');
background-repeat: no-repeat;
background-size: 200px 200px;
background-position: 50% 50px;
}
fetch(url)
.then(data => {
return data.json()
})
.then(res => {
console.log(res)
})
.catch(err => {
console.log(err)
})
## Custom Aliases
#
# Make sure to paste this snippet in your ~/.bashrc
#
# if [ -e $HOME/.bash_aliases ]; then
# source $HOME/.bash_aliases
# fi
alias c='clear'
alias ..='cd ..'
@leopolicastro
leopolicastro / reverShell.ipynb
Created October 23, 2019 12:12
pyhack/reverShell.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.