Skip to content

Instantly share code, notes, and snippets.

View rberrelleza's full-sized avatar
👋
Hi friend!

Ramiro Berrelleza rberrelleza

👋
Hi friend!
View GitHub Profile
@rberrelleza
rberrelleza / DisableStrictHostChecking.sh
Last active December 17, 2015 03:29
Disable strict host checking
echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
@rberrelleza
rberrelleza / auth_token.sh
Last active December 17, 2015 05:29
Script to generate an auth token on github enterprise
curl http://git.office.elasticbox.com/api/v3/authorizations -u jenkins --data '{"scopes":["repos"]}'
@rberrelleza
rberrelleza / kill_wait.sh
Created June 7, 2013 21:14
bash script to kil and wait until it exits
#!/bin/bash
ps aux | grep $1 | grep -v grep | grep -v gone.sh
if [ $? -eq 0 ]; then
#kill -9 $(ps aux | grep $1 | grep -v grep | awk '{ print $2 }')
process=$(ps aux | grep $1 | grep -v grep | grep -v gone.sh | awk '{ print $2 }')
kill $process
fi
is_gone=0
@rberrelleza
rberrelleza / add-users.ps1
Last active December 19, 2015 00:39
Create AD users from a CSV
$domain = (get-addomain).distinguishedname
$location = "OU=Engineering,$domain"
$domain_email = 'yourdomain.com'
$i = 0
Get-Content .\names.csv.txt | ForEach {
$i++
$names = $_.Split()
$first = $names[0]
$last = $names[1]
$username = "$first" + "." + "$last"
@rberrelleza
rberrelleza / mount_volume.sh
Created September 19, 2013 00:08
Mount AWS volume on Ubuntu
#!/bin/bash
if [[ -z `fdisk -l | grep /dev/xvdb` ]];then
mkdir -p -m 755 /data
result=$(ec2-create-volume --size 100 --availability-zone \$AVAILABILITY_ZONE --region \$REGION_ID)
ec2-attach-volume --region \$REGION_ID $volume -i \$INSTANCE_ID -d /dev/xvdb
while [[ -z `fdisk -l | grep /dev/xvdb` ]]; do sleep 1; done
mkfs.ext4 /dev/xvdb
echo "/dev/xvdb /data auto noatime 0 0" | tee -a /etc/fstab
reboot
@rberrelleza
rberrelleza / pr.md
Created October 31, 2013 17:44 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@rberrelleza
rberrelleza / key_on_commit.sh
Created December 9, 2014 21:49
Git hook to append issue name to a commit
#!/bin/sh
#
# git prepare-commit-msg hook for automatically prepending an issue key
# from the start of the current branch name to commit messages.
# check if commit is merge commit
if [ $2 = "merge" ]; then
exit
fi
ISSUE_KEY=`git branch | grep -o "\* \(.*/\)*[A-Z]\{2,\}-[0-9]\+" | grep -o "[A-Z]\{2,\}-[0-9]\+"`
cd submodule_directory
git checkout v1.0
cd ..
git add submodule_directory
git commit -m "moved submodule to v1.0"
git push
@rberrelleza
rberrelleza / share_file.py
Last active November 25, 2015 23:23
Share a file with a hipchat room
#!/bin/python
import argparse
import json
import os.path
import re
import requests
import sys
from email.mime.multipart import MIMEMultipart
from email.mime.nonmultipart import MIMENonMultipart
@rberrelleza
rberrelleza / scraper.py
Created April 11, 2015 02:56
Screen scrapper+pngcrusher exercise to
import shutil
import requests
from bs4 import BeautifulSoup
from tinypng import shrink_file
requests.packages.urllib3.disable_warnings()
response = requests.get("YOUR_URL")
soup = BeautifulSoup(response.text, 'html.parser')
images = soup.find_all('img')