Skip to content

Instantly share code, notes, and snippets.

View icasimpan's full-sized avatar

Ismael Casimpan Jr. icasimpan

View GitHub Profile
@icasimpan
icasimpan / gist:0cc2260cadd6e8a76f3d
Created October 13, 2015 05:44 — forked from haf/gist:2843680
Get SSH working on Vagrant/Windows/Git

If you are using vagrant, you probably-statistically are using git. Make sure you have its binary folder on your path, because that path contains 'ssh.exe'.

Now, modify C:\vagrant\vagrant\embedded\lib\ruby\gems\1.9.1\gems\vagrant-1.0.3\lib\vagrant\ssh.rb to comment out the faulty Windows check and add a real SSH check:

# if Util::Platform.windows?
  # raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],
                                       # :port => ssh_info[:port],
                                       # :username => ssh_info[:username],
 # :key_path => ssh_info[:private_key_path]
@icasimpan
icasimpan / php_upgrade_to_71.sh
Created October 25, 2017 21:11 — forked from pixeline/php_upgrade_to_71.sh
Update Mac Os X's php version to php 7.1 using homebrew. Includes curl and mcrypt
# 1. Install brew --> http://brew.sh/
# 2. run the following commands in your Terminal
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install --with-openssl curl
brew install --with-homebrew-curl --with-apache php71
brew install php71-mcrypt php71-imagick
# 3. Follow these instructions to make Apache and php-cli use the newer php executable and make the change persist after reboot.
brew info php71
@icasimpan
icasimpan / today_isoweek.go
Last active October 18, 2024 22:14
golang: getting today's week number
package main
import "fmt"
import "time"
func main() {
var time_now time.Time = time.Now() // [ALTERNATIVE] time_now := time.Now()
var _, wk_num = time_now.ISOWeek() // [ALTERNATIVE] _, wk_num := time_now.ISOWeek()
fmt.Println(wk_num)
@icasimpan
icasimpan / nginx-centos7.yml
Created October 29, 2017 13:54
Sample ansible playbook to install nginx with sample page on CentOS7
## Credits to John Lieske - https://www.ansible.com/blog/getting-started-writing-your-first-playbook
---
- name: Install nginx
hosts: host.name.ip
become: true
tasks:
- name: Add epel-release repo
yum:
name: epel-release
@icasimpan
icasimpan / pedantically_commented_playbook.yml
Created November 23, 2017 14:41 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
curl -s "https://api.ipify.org?format=jsonp&callback=getIP"|cut -d'"' -f4 ## This is used by http://www.showmyipaddress.com/ as of Dec 18, 2017
@icasimpan
icasimpan / curl_custom_dns.sh
Created December 21, 2017 21:58 — forked from CMCDragonkai/curl_custom_dns.sh
cURL: Selecting a custom DNS server to resolve domain names
#!/usr/bin/env bash
# this can be useful when developing against a custom DNS server, or
# for example, if you made a change to the DNS settings of a domain, and you
# know the authoritative nameserver IP address for a domain, you could use this
# to bypass the intermediate DNS cache, and apply an HTTP request using the new
# DNS settings supplied by your specified (authoritative) nameserver
curl --dns-servers <dns.ip,dns.ip> url.com
@icasimpan
icasimpan / db-connect-test.php
Created December 28, 2017 15:26 — forked from chales/db-connect-test.php
Script for a quick PHP MySQL DB connection test.
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@icasimpan
icasimpan / https_checker.py
Created April 13, 2018 07:42
Given a text file 'client_domains.txt' check which one are not yet forced to do https
#!/usr/bin/env python3
import subprocess, re
## client_domains.txt format:
## <client_id>:<http_user>:<http_password>:<domain>
##
client_domains='client_domains.txt'
with open(client_domains) as fp:
@icasimpan
icasimpan / drupalgeddon2_CVE-2018-7600_SA-CORE-2018-002.md
Created April 27, 2018 07:27 — forked from g0tmi1k/drupalgeddon2_CVE-2018-7600_SA-CORE-2018-002.md
drupalgeddon2 / SA-CORE-2018-002 / CVE-2018-7600 cURL (PoC)