Skip to content

Instantly share code, notes, and snippets.

View surgiie's full-sized avatar
🔥
Ok

Sergio Compean surgiie

🔥
Ok
View GitHub Profile
@stafot
stafot / reset_virtualbox_dhcp_leases.sh
Last active November 3, 2020 11:15
Resets virtualbox DHCP leases to ensure that minikube will always take a specific IP.
#!/usr/bin/env bash
function minikube_reset_vbox_dhcp_leases() {
# Check OS version
case $OSTYPE in
darwin*)
VBOX_CONFIG_DIR=Library
;;
linux*)
<button onclick="recordStop()" id="record-stop-button">Record</button>
<button onclick="playAudio()" disabled id="play-audio-button">Play</button>
<script>
const recordAudio = () =>
new Promise(async resolve => {
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
const mediaRecorder = new MediaRecorder(stream);
const audioChunks = [];
mediaRecorder.addEventListener("dataavailable", event => {
@onildoaguiar
onildoaguiar / bullet-train-for-oh-my-zsh-on-ubuntu.md
Last active June 18, 2019 16:55
Bullet Train for oh-my-zsh on Ubuntu

About

How to install Bullet Train for oh-my-zsh on Ubuntu.

Install zsh

$ sudo apt-get install zsh
$ sudo apt-get install git-core
@donmccurdy
donmccurdy / wildcard-to-regexp.js
Last active February 21, 2024 06:49
Wildcard and glob matching in JavaScript.
/**
* Creates a RegExp from the given string, converting asterisks to .* expressions,
* and escaping all other characters.
*/
function wildcardToRegExp (s) {
return new RegExp('^' + s.split(/\*+/).map(regExpEscape).join('.*') + '$');
}
/**
* RegExp-escapes all characters in the given string.
@sl-digital
sl-digital / docker-iptables-rules.v4
Last active January 23, 2023 03:55
Docker iptables for NGINX web services and local MySQL
sudo iptables -A INPUT -i lo -j ACCEPT
sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
sudo iptables -A INPUT -j DROP
# Allow traffic coming from docker0 interface
sudo iptables -I INPUT 6 -i docker0 -p tcp --dport 3306 -j ACCEPT
@vluzrmos
vluzrmos / paginate.php
Created July 20, 2016 14:31
Laravel Paginate Collection or Array
<?php
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
* @param int $perPage
* @param int $page
* @param array $options
*
* @return LengthAwarePaginator
@bigomega
bigomega / load-test.sh
Created March 3, 2016 11:03
A simple bash script to do load (performance) testing of a web service
max="$1"
date
echo "url: $2
rate: $max calls / second"
START=$(date +%s);
get () {
curl -s -v "$1" 2>&1 | tr '\r\n' '\\n' | awk -v date="$(date +'%r')" '{print $0"\n-----", date}' >> /tmp/perf-test.log
}
@JeffreyWay
JeffreyWay / .bash_profile
Created July 31, 2015 19:20
Prettier git logs
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@JeffreyWay
JeffreyWay / countries.php
Created July 23, 2015 17:01
Country Names + Codes
[
"United States" => "us",
"Afghanistan" => "af",
"Albania" => "al",
"Algeria" => "dz",
"American Samoa" => "as",
"Andorra" => "ad",
"Angola" => "ad",
"Anguilla" => "ai",
"Antarctica" => "aq",
@derrekbertrand
derrekbertrand / post_install.sh
Last active July 22, 2018 18:43
PHP development machine post install setup for Ubuntu 16.04/18.04 and Mint 18/19
#!/bin/bash
# Post install script for Ubuntu 18.04LTS and Mint 19LTS
# add the PHP PPA https://deb.sury.org/
sudo add-apt-repository -y ppa:ondrej/php
# set up node sources
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
# add Sublime Text 3 stable to your sources