This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# Method 1: Install using rpm packages (credit to DarkMukke) | |
# | |
rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm | |
rpm --import http://mirror.ghettoforge.org/distributions/gf/RPM-GPG-KEY-gf.el7 | |
# WARNING: removing vim-minimal uninstalls `sudo` if you skip the second step | |
# make sure to at least run `yum install sudo` | |
yum -y remove vim-minimal vim-common vim-enhanced |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import math | |
from BeautifulSoup import BeautifulSoup | |
def distance_on_unit_sphere(lat1, long1, lat2, long2): | |
"src: http://www.johndcook.com/python_longitude_latitude.html" | |
degrees_to_radians = math.pi/180.0 | |
phi1 = (90.0 - lat1)*degrees_to_radians | |
phi2 = (90.0 - lat2)*degrees_to_radians |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' src: http://www.mcgimpsey.com/excel/removepwords.html | |
' | |
' Removing Internal XL passwords | |
' | |
' Note: For a discussion of File or VBA Project password protection, see here. | |
' | |
' Internal XL passwords are about as useful for security as tissue paper. The | |
' reason is that the passwords you enter (i.e., with Tools/Protect/Protect | |
' Worksheet or /Protect Workbook) are not used directly in protection. Instead | |
' they are hashed (mathematically transformed) into a much less secure code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ******************************************************************************************* | |
* THE UPDATED VERSION IS AVAILABLE AT | |
* https://github.com/LeCoupa/awesome-cheatsheets | |
* ******************************************************************************************* */ | |
// 0. Synopsis. | |
// http://nodejs.org/api/synopsis.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
amazon_sender.py | |
~~~~~~~~ | |
Python helper class that can send emails using Amazon SES and boto. | |
The biggest feature of this class is that encodings are handled properly. | |
It can send both text and html emails. | |
This implementation is using Python's standard library (which opens up for a lot more options). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# See my post on http://stackoverflow.com/questions/33725298/perl-disable-shell-access | |
# Ref: https://github.com/Perl/perl5/blob/blead/lib/CORE.pod | |
BEGIN { | |
*CORE::GLOBAL::system = sub { | |
die('Do not use system calls.'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Turn on table based logging | |
set global log_output = 'TABLE'; | |
-- Turn on general log | |
set global general_log = 'ON'; | |
-- Log everything to slow query log | |
set global log_slow_queries = 1; | |
set global long_query_time = 0.000001; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A very simple Flask Hello World app for you to get started with... | |
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return 'Hello from Flask!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You may use this CentOS 7 repository on Fedora Copr for Vim 8 builds. | |
# https://copr.fedorainfracloud.org/coprs/mcepl/vim8/ | |
# | |
# Run these commands on CentOS 7. | |
# Add this repository: | |
sudo curl -L https://copr.fedorainfracloud.org/coprs/mcepl/vim8/repo/epel-7/mcepl-vim8-epel-7.repo -o /etc/yum.repos.d/mcepl-vim8-epel-7.repo | |
# Upgrade Vim to vim 8: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# encoding: utf-8 | |
class Romanize(): | |
# Values from https://www.math.nmsu.edu/~pmorandi/math111f01/RomanNumerals.html | |
numbers = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] | |
numeral = [ 'm', 'cm', 'd', 'cd', 'c', 'xc', 'l', 'xl', 'x', 'ix', 'v', 'iv', 'i'] | |
def calculate(number): | |
out = "" |
NewerOlder