Skip to content

Instantly share code, notes, and snippets.

View hugmouse's full-sized avatar
🏳️‍🌈
<- a rainbow flag wow

Mysh! hugmouse

🏳️‍🌈
<- a rainbow flag wow
View GitHub Profile
@hugmouse
hugmouse / fizzbuzz.go
Created February 12, 2020 15:32
FizzBuzz task, but the input of which is a number that is larger than the machine word (https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic)
package main
import (
"fmt"
"math/big"
)
func FizzBuzz(n string) string {
var i, x, one, zero, fizz, buzz, result big.Int
@hugmouse
hugmouse / easyDBCopy.go
Created December 9, 2019 14:36
Easy way to copy one EasyDB to another EasyDB
package easyDBCopy
import (
easy "github.com/EasyDB-io/Golang/client"
)
type DB struct {
database string
token string
}
@hugmouse
hugmouse / replace-ubuntu-archive-mirror.sh
Created October 30, 2019 04:32
Replaces "archive.ubuntu.com" with "mirror.yandex.ru"
sudo sed -i 's/archive.ubuntu.com/mirror.yandex.ru/g' /etc/apt/sources.list
@hugmouse
hugmouse / bash.php
Last active April 24, 2019 07:03
Простой пример работы с Simple Html Dom - переход по ссылкам, найденым на изначальной странице
<?php
include "./simple_html_dom.php";
// Создаем дом
$html = file_get_html('https://bash.im');
// Находим ссылки
foreach($html->find('a[class=quote__header_permalink]') as $a) {
// Находим ссылки и берем у них аттрибут "Href", он бывает относительный и поэтому...
$url = $a->href;
// ...я добавляю "https://bash.im" здесь, так как на этом сайте все ссылки - относительные.