Skip to content

Instantly share code, notes, and snippets.

View airvzxf's full-sized avatar

Israel Roldan airvzxf

View GitHub Profile
@airvzxf
airvzxf / Ejercicio-001.rb
Last active December 16, 2015 15:18
Codecery :: | Beautiful asterisk in console mode | Fahrenheit to Celsius | Celsius to Fahrenheit |
##### Fahrenheit to Celsius
def convert(f)
c = ((f.to_i-32)*(5.0/9.0))
c = (c * 10).round * 0.1
end
puts "Convert Fahrenheit to Celsius."
print "Input the Fahrenheit: "
f = gets
@airvzxf
airvzxf / Exercise-002.rb
Created April 25, 2013 17:10
Codecery :: Exercise 002
##### Adds
puts "Adds n + (n-x)."
#print "Input an integer number: "
#n = gets
n = 5
(n).downto(0) do |a|
x = n-a
break if a < x
puts "#{a} + #{x} = #{a+x}"
@airvzxf
airvzxf / Exercise-003.rb
Created April 26, 2013 16:40
Codecery :: Exercise 003
##### Perfect Number
puts "This is the perfect number."
x = 30
(x).times do |n|
(n).downto(1) do |a|
#puts "a: #{a}"
d = 0
(1..a).each do |b|
if a % b == 0
@airvzxf
airvzxf / Exercise-004.rb
Last active December 16, 2015 19:08
Codecery :: Exercise 004
require 'test/unit'
extend Test::Unit::Assertions
FIRST_TEN = ["zero ", "one ", "two ", "three ", "four ", "five ", "six ", "seven ", "eight ", "nine "]
SECOND_TEN = ["ten ", "eleven ", "twelve ", "thirteen ", "fourteen ", "fifteen ", "sixteen ", "seventeen ", "eighteen ", "nineteen "]
OTHER_TENS = ["", "", "twenty ", "thirty ", "forty ", "fifty ", "sixty ", "seventy ", "eighty ", "ninety "]
HUNDRED = "hundred "
def number2text(number)
@airvzxf
airvzxf / inject-python-functions.pl
Created December 6, 2020 04:51
Perl: Inject inside of every Python function (`def`) a print statement on this way you can see what is executing during runtime.
#!/usr/bin/perl
#
# Strict and warnings are recommended.
use strict;
use warnings;
use Cwd;
use File::Find;
my $base_path = Cwd::cwd . '/';
my $path = $base_path . 'pwndbg/';
@airvzxf
airvzxf / github-actions-delete.bash
Created June 5, 2021 03:49
GitHub API -> Delete Runs from Workflows (Actions)
#!/usr/bin/env bash
USERNAME="my_user"
REPOSITORY="the_repo"
TOKEN="ghp_github_token permissions: repo, workflow"
WORKFLOW_RUNS=$(
curl \
-H "Accept: application/vnd.github.v3+json" \
--silent \
@airvzxf
airvzxf / faster_mirrorlist_pacman.sh
Last active March 26, 2022 15:58
Update the mirrorlist of Pacman adding the faster server available.
#!/bin/bash +xv
echo -e "~~~~~~~~~~~ START THE SERVICE TO RUN REFLECTOR ~~~~~~~~~~~"
echo ""
while [ 1 ]
do
if ping -c 1 google.com >> /dev/null 2>&1
then
echo -e "~~~~~~~~~~~ RUN THE REFLECTOR PACKAGE ~~~~~~~~~~~"
import java.math.BigDecimal;
public class Main {
public static void main(String[] args) {
sumDiffOrder();
sumNotCorrect();
sumCorrect();
}
private static void sumDiffOrder() {
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Example about decimals.
"""
from decimal import Decimal
def sum_diff_order():
"""
#include <iostream>
#include <cstring>
int main() {
// Convert String into Array of Strings.
// Managing memory is usually a feat.
// Furthermore, execute in terminal: `g++ main.cpp -o strings-c`.
const char *text = "a/apple/arm/basket/bread/car/camp/element/...";
char split_char = '/';
char *token, *str, *toFree;