Skip to content

Instantly share code, notes, and snippets.

View caiquecastro's full-sized avatar
🎯
Focusing

Caíque de Castro Soares da Silva caiquecastro

🎯
Focusing
View GitHub Profile
@caiquecastro
caiquecastro / calc_age.js
Created March 9, 2015 18:17
Calculate age
function calcAge(birth_date) {
var today = new Date;
var age = {
years: 0,
months: 0
};
age.years = today.getFullYear() - birth_date.getFullYear();
wget --mirror -p --convert-links -P ./LOCAL http://website.address.com
#!/bin/bash
# Make sure that all text is parsed in the same language
export LC_MESSAGES=en_US.UTF-8
export LC_COLLATE=en_US.UTF-8
export LANG=en_US.utf8
export LANGUAGE=en_US:en
export LC_CTYPE=en_US.UTF-8
# Calculate how much memory and swap is free
#! /bin/bash
set -eou pipefail
#usage: sudo ./docker-cleanup-volumes.sh [--dry-run]
docker_bin=$(which docker.io 2> /dev/null || which docker 2> /dev/null)
# Default dir
dockerdir=/var/lib/docker
#!/bin/bash
while ! ping -n -c 1 8.8.8.8
do
sleep 10
done
echo "network is working"
cat ~/.ssh/id_rsa.pub | ssh [email protected] "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
@caiquecastro
caiquecastro / USAGE.md
Last active January 26, 2018 12:52
Commiters share

Usage

Change file permission:

chmod +x commiters-share.php

Move the scripts to your bin folder:

@caiquecastro
caiquecastro / composer.json
Created September 21, 2016 13:52
TOTP library for PHP
{
"name": "caique/otp",
"authors": [
{
"name": "Caique de Castro",
"email": "[email protected]"
}
],
"require": {
"rych/otp": "^1.1",
@caiquecastro
caiquecastro / thread.php
Created November 7, 2016 13:48
PHP tem thread
<?php
class SimpleWorkerThread extends Thread
{
private $workerId = 0;
public function __construct($id)
{
$this->workerId = $id;
}
@caiquecastro
caiquecastro / sort.sh
Last active December 9, 2016 13:32
Sort on shell
#!/usr/bin/env sh
# Prints a random line from a file
# Script by @augustohp
lines_on() {
file=$1
wc -l $file | awk '{print $1}'
}
random_until() {
max=$1