Skip to content

Instantly share code, notes, and snippets.

View nisevi's full-sized avatar
🧑‍🚀
Working from anywhere

Nicolas Sebastian Vidal nisevi

🧑‍🚀
Working from anywhere
View GitHub Profile
@nisevi
nisevi / puller.rb
Last active July 20, 2020 00:26
Recursively iterate over all subfolders and execute 'git pull' on all paths that have '.git'
#!/usr/bin/env ruby
class PathManager
DEFAULT_DIRECTORY = '.'
attr_accessor :base_directory, :invalid_filenames
def initialize(args = {})
self.base_directory = expand_path(args.fetch(:base_directory, DEFAULT_DIRECTORY))
self.invalid_filenames = args[:invalid_filenames]
@nisevi
nisevi / cloner.py
Created July 19, 2020 23:41
Clone all repositories from a given Organization
import os
from github import Github
g = Github("token-goes-here")
org = g.get_organization("organization-name-goes-here")
repos = org.get_repos()
for repo in repos:
cmd = "git clone {}".format(repo.ssh_url)
@nisevi
nisevi / string_spec.rb
Created May 3, 2019 14:52
Spec for covering the new methods
# frozen_string_literal: true
require_relative "../../../lib/thanoscase/string"
RSpec.describe "String class" do
it "should shorten an even string to half its size" do
expect("1234".thanoscase.length).to eq(2)
end
it "should shorten an odd string to half its size plus 1" do
@nisevi
nisevi / thanoscase.gemspec
Created May 3, 2019 14:27
Gemspec file with the addition of RSpec library
# frozen_string_literal: true
Gem::Specification.new do |s|
s.name = "thanoscase"
s.version = "0.0.1"
s.date = "2019-04-27"
s.summary = "Thanos gem"
s.description = "Randomly removes half the characters of a given string."
s.authors = ["Nicolas Sebastian Vidal"]
s.email = "[email protected]"
@nisevi
nisevi / Gemfile
Last active May 3, 2019 14:33
Gemfile for adding RSpec to our gem
source 'https://rubygems.org'
gemspec
@nisevi
nisevi / config.yml
Created May 3, 2019 04:42
Basic RSpec coverage with CircleCI
version: 2.1
commands:
cached-bundle:
steps:
- restore_cache:
keys:
- gem-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
- gem-cache-v1-{{ arch }}-{{ .Branch }}
- gem-cache-v1
- run: bundle install --path vendor/bundle
@nisevi
nisevi / thanoscase.rb
Created May 1, 2019 17:47
File for importing the archives inside lib folder
# frozen_string_literal: true
require "thanoscase/string"
@nisevi
nisevi / thanoscase.gemspec
Last active May 3, 2019 04:40
Gemspec file, our interface to RubyGems
# frozen_string_literal: true
Gem::Specification.new do |s|
s.name = "thanoscase"
s.version = "0.0.1"
s.date = "2019-04-27"
s.summary = "Thanos gem"
s.description = "Randomly removes half the characters of a given string."
s.authors = ["Nicolas Sebastian Vidal"]
s.email = "[email protected]"
@nisevi
nisevi / string.rb
Created May 1, 2019 15:15
MonkeyPatch the String class for adding two new methods
# frozen_string_literal: true
class String
def thanoscase!
return self if empty?
half_universe = length/2
half_universe.times { slice!(rand(length)) }
self
end
@nisevi
nisevi / http3.py
Created April 30, 2019 15:02
TPL 5 - EJ14 - World Wide Web - HTTP
# coding: utf-8
import BaseHTTPServer
HOST_NAME = 'localhost'
PORT = 8000
def detectar_so(user_agent):
# Ver listados en http://www.useragentstring.com/pages/useragentstring.php
if 'Linux' in user_agent: