Skip to content

Instantly share code, notes, and snippets.

@giper45
giper45 / gist:aead6920e219ed746a319fa92cbf3ebc
Created December 7, 2018 09:07
Vagrantfile Windows template
# Defines our Vagrant environment
#
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define :namemachine do |config|
config.vm.box = "win7"
config.vm.hostname = "one-win7-1"
config.vm.network :private_network, ip: "10.111.22.155"
OUTPUT_PUBLIC_KEY_PATH="pub.txt"
HEX_MODULUS=$(openssl rsa -pubin -in $OUTPUT_PUBLIC_KEY_PATH -modulus | grep 'Modulus=' | cut -d'=' -f 2)
ruby<<EOF
p "$HEX_MODULUS".to_i(16).to_s(10)
EOF
openssl rsa -pubin -in $OUTPUT_PUBLIC_KEY_PATH -text | grep 'Exponent'
#!/bin/bash
############################
## Methods
############################
prefix_to_bit_netmask() {
prefix=$1;
shift=$(( 32 - prefix ));
bitmask=""
# SYNOPSIS
# manopt command opt
#
# DESCRIPTION
# Returns the portion of COMMAND's man page describing option OPT.
# Note: Result is plain text - formatting is lost.
#
# OPT may be a short option (e.g., -F) or long option (e.g., --fixed-strings);
# specifying the preceding '-' or '--' is OPTIONAL - UNLESS with long option
# names preceded only by *1* '-', such as the actions for the `find` command.
@giper45
giper45 / common_usernames
Created April 5, 2019 13:03
Common usernames
111111
123456
12345678
abc123
abramov
account
accounting
ad
adm
admin
@giper45
giper45 / Vagrantfile
Created April 17, 2019 18:03 — forked from drgarcia1986/Vagrantfile
Hello World with Ansible and Vagrant
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 8000, host: 8000
config.vm.provision :ansible do |ansible|
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
# -*- mode: ruby -*-
# vi: set ft=ruby :
if !Vagrant.has_plugin?("vagrant-docker-compose")
puts "Pls install vagrant-docker-compose (vagrant plugin install vagrant-docker-compose), then try 'vagrant up' again"
system("vagrant plugin install vagrant-docker-compose")
exit
end
if !Vagrant.has_plugin?("vagrant-disksize")
puts "Pls install vagrant-disksize (vagrant plugin install vagrant-disksize), then try 'vagrant up' again"
@giper45
giper45 / async_for_each.js
Created January 10, 2020 14:11
Async for each nodejs
async function asyncForEach(array, callback) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array);
}
}
@giper45
giper45 / daemon.json
Created July 7, 2020 15:56
Full docker daemon configuration example
{
"authorization-plugins": [],
"data-root": "",
"dns": [],
"dns-opts": [],
"dns-search": [],
"exec-opts": [],
"exec-root": "",
"experimental": false,
"features": {},