Skip to content

Instantly share code, notes, and snippets.

View algotrader-dotcom's full-sized avatar

Mai_Xoa algotrader-dotcom

View GitHub Profile
@algotrader-dotcom
algotrader-dotcom / sys_uptime.py
Created July 11, 2017 06:52 — forked from carlkibler/sys_uptime.py
Retrieve system uptime with Python
import subprocess
def uptime():
raw = subprocess.check_output('uptime').replace(',','')
days = int(raw.split()[2])
if 'min' in raw:
hours = 0
minutes = int(raw[4])
else:
hours, minutes = map(int,raw.split()[4].split(':'))
# 10_basic.py
# 15_make_soup.py
# 20_search.py
# 25_navigation.py
# 30_edit.py
# 40_encoding.py
# 50_parse_only_part.py
@algotrader-dotcom
algotrader-dotcom / README.md
Created January 13, 2017 17:32 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Index:

@algotrader-dotcom
algotrader-dotcom / terraform-2tier-vpc
Created November 1, 2016 11:21 — forked from bluemalkin/terraform-2tier-vpc
Terraform 2 tier VPC with nat
# define some variables
variable "aws_ubuntu_ami" {
default = "ami-972444ad"
}
variable "aws_keypair" {
default = "xxxx"
}
# AWS account details
@algotrader-dotcom
algotrader-dotcom / slackpost
Created October 7, 2016 04:45 — forked from dopiaza/slackpost
Post a message to a Slack channel
#!/bin/bash
# Usage: slackpost <token> <channel> <message>
# Enter the name of your slack host here - the thing that appears in your URL:
# https://slackhost.slack.com/
slackhost=PUT_YOUR_HOST_HERE
token=$1
@algotrader-dotcom
algotrader-dotcom / README.md
Created August 15, 2016 04:23 — forked from magnetikonline/README.md
Nginx FastCGI cache configuration example.

Nginx FastCGI cache

Example /etc/nginx/nginx.conf using FastCGI (e.g. to PHP-FPM) with FastCGI cache enabled. This will capture returned data and persist it to a disk based cache store for a configurable amount of time, great for robust full page caching.

Will need to create a directory to hold cache files, for the example given here that would be:

$ sudo mkdir -p /var/cache/nginxfastcgi
$ chown www-data: /var/cache/nginxfastcgi
@algotrader-dotcom
algotrader-dotcom / ftpFileserveUploader.py
Created August 11, 2016 06:38 — forked from slok/ftpFileserveUploader.py
Python script to upload various files to fileserve with FTP.
# Copyright (c) 2011, Xabier (slok) Larrakoetxea
# Copyright (c) 2011, Iraide (Sharem) Diaz
#
# 3 clause/New BSD license:
# opensource: http://www.opensource.org/licenses/BSD-3-Clause
# wikipedia: http://en.wikipedia.org/wiki/BSD_licenses
#
#-----------------------------------------------------------------------
# This script allows to upload to Fileserve with FTP various files at the same time
#
@algotrader-dotcom
algotrader-dotcom / deploy.yml
Created August 9, 2016 07:21 — forked from mig5/deploy.yml
Ansible playbook to deploy Drupal
---
- hosts: all
gather_facts: no
tasks:
- name: Backup database
shell: "{{ item }}"
with_items:
- mkdir -p ~jenkins/dbbackups
- drush @{{ shortname }}_{{ env }} sql-dump --skip-tables-key=common | gzip > ~jenkins/dbbackups/{{ shortname }}_{{ env }}_prior_to_{{ build }}.sql.gz
@algotrader-dotcom
algotrader-dotcom / mysql_pwd_reset.sh
Created August 6, 2016 18:24 — forked from thomasmb/mysql_pwd_reset.sh
A shell script for resetting the root MySQL password
# Please confirm that you want to reset the MySQL passwords
CONFIRM="n"
echo -n "Please confirm MySQL password reset. Continue? (y/N): "
read -n 1 CONFIRM_INPUT
if [ -n "$CONFIRM_INPUT" ]; then
CONFIRM=$CONFIRM_INPUT
fi
echo
@algotrader-dotcom
algotrader-dotcom / search-api-redhen-contact-autocomplete.php
Created June 21, 2016 15:40 — forked from wxactly/search-api-redhen-contact-autocomplete.php
Drupal Search API - Simple RedHen contact autocomplete
<?php
/**
* Implements hook_menu().
*/
function MY_MODULE_menu() {
$items['MY_MODULE/redhen/contact/autocomplete'] = array(
'title' => 'Autocomplete for RedHen Contacts',
'page callback' => 'MY_MODULE_contact_autocomplete',
'access callback' => 'redhen_contact_access',