Skip to content

Instantly share code, notes, and snippets.

@Sydney-o9
Sydney-o9 / package-vagrant-box.sh
Last active August 29, 2015 14:27
(Re)-package CentOS 6.6 Box
#!/usr/bin/env bash
echo "1. Yum Cleaning"
sudo yum clean all
echo "2. Clean /tmp folder"
sudo rm -rf /tmp/*
echo "3. Removing log files"
sudo rm -f /var/log/wtmp /var/log/btmp
#!/bin/bash
#
# /etc/rc.d/init.d/hhvm
#
# Starts the hhvm daemon
#
# chkconfig: 345 26 74
# description: HHVM (aka the HipHop Virtual Machine) is an open-source virtual machine designed for executing programs written in Hack and PHP
# processname: hhvm
@Sydney-o9
Sydney-o9 / fix-ssh-vagrant-box.sh
Last active December 1, 2015 00:43
Fix SSH Error in Vagrant Box
#!/usr/bin/env bash
echo "1. Download public SSH Key vagrant.pub and replace it to .ssh/authorized_keys"
wget https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys
echo "2. Change Permissions .ssh/ (chmod 700)"
chmod 700 .ssh
echo "3. Change Permissions .ssh/ (vagrant:vagrant)"
chown -R vagrant:vagrant .ssh
@Sydney-o9
Sydney-o9 / hostapdstop.sh
Created July 21, 2017 08:24
hostapdstop.sh
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Stop hostapd
# service hostapd stop
/etc/init.d/hostapd stop
# Bring wlan1 interface down
# ifdown wlan1
@Sydney-o9
Sydney-o9 / hostapdstart.sh
Created July 21, 2017 08:24
hostapdstart.sh
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# 1. Add virtual interface
echo "-> Adding Virtual Interface wlan1"
iw dev wlan0 interface add wlan1 type __ap
if [ $? -eq 0 ]; then
echo "OK"
# wpa_supplicant
/sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
#
# dhclient
#
# Configure one or more network interfaces using the Dynamic Host Configuration Protocol,
# BOOTP Protocol, or if these protocols fail, by statically assigning an address.
@Sydney-o9
Sydney-o9 / config.yml
Last active January 29, 2018 21:03
#CircleCI - Tip 1 - Snippet 1
- run:
name: Build Success
when: on_success
command: |
echo "I am executed when the build succeeds..."
- run:
name: Build Failed
when: on_fail
command: |
echo "I am executed when the build fails..."
# Returns 1 if java installed, 0 otherwise
which java | grep -c java
# Create folders
sudo mkdir -p /usr/local/selenium/bin /usr/local/selenium/drivers
# Donwload latest selenium server .jar file
cd /usr/local/selenium/bin
wget http://selenium-release.storage.googleapis.com/3.8/selenium-server-standalone-3.8.1.jar
# Download latest chromedriver
cd /usr/local/selenium/drivers
wget https://chromedriver.storage.googleapis.com/2.35/chromedriver_mac64.zip
# Show the last 15 group id created
dscacheutil -q group | grep gid | awk ‘{print $2}’ | sort -n | tail -n 5