Skip to content

Instantly share code, notes, and snippets.

View gt50's full-sized avatar

Shawn Q Jackson gt50

View GitHub Profile
if __name__ == '__main__':
students = []
scores = []
for _ in range(int(input())):
name = input()
score = float(input())
students.append([name, score])
scores.append(score)
scores = list(set(scores))
students.sort(key = lambda x: (x[1], x[0]))
if __name__ == '__main__':
students = []
for _ in range(int(input())):
name = input()
score = float(input())
students.append([name, score])
students.sort(key = lambda x: (x[1], x[0]))
for student in students:
if (student[1] == students[1][1]):
print(student[0])
function largestOfFour(arr) {
var largeNumber = arr[0][0]
for (var i = 0; i < arr.length; i++) {
largeNumber = Math.max(largeNumber, Math.max.apply(null,arr[i])); // You can do this!
}
return largeNumber;
}
console.log(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]))
@gt50
gt50 / docker-compose-coreos.sh
Last active January 4, 2017 00:31 — forked from sourcec0de/docker-compose-coreos.sh
Install docker compose on coreos
sudo su -
mkdir -p /opt/bin
curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
class smokeping::packages{
package { 'epel-release': ensure => present}
package { 'mod_fcgid': ensure => present }
package { 'httpd': ensure => present }
package { 'httpd-devel': ensure => present }
package { 'rrdtool': ensure => present }
package { 'perl-CGI-SpeedyCGI': ensure => present }
package { 'fping': ensure => present }
package { 'rrdtool-perl': ensure => present }
package { 'perl': ensure => present }
@gt50
gt50 / foreman06142016
Last active June 14, 2016 19:08
Foreman install on Centos 7
Foreman 1.12 and puppet 4 could not complete installation using Centos 7, Ubuntu 16.04 or Debian 8 for me. The first successful install I managed was on Centos 7 using puppet 3 and Foreman 1.11. Foreman 1.12 is only one week old, so I am sure the problem will be resolved soon.
Install Centos 7 with static ip and make sure ping $(hostname -f) is pinging the ip address of the interface and not loopback.
rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
yum -y install epel-release https://yum.theforeman.org/releases/1.11/el7/x86_64/foreman-release.rpm
yum -y install foreman-installer
foreman-installer
systemctl stop firewalld
systemctl disable firewalld
@gt50
gt50 / gist:1fecbdcfe1d2b45d5469
Last active August 28, 2015 04:24
How to get async calls in order?
var http = require('http');
var urls = process.argv.slice(2);
var responses = process.argv.slice(2);
var completedReqests = 0;
for (var i=0; i < urls.length;i++){
http.get(urls[i],(function (i){
return function(response){
var webData = '';
@gt50
gt50 / gist:2699ee03ce253a32d979
Created August 3, 2015 20:52
Xencenter connection fail with Windows 10
# Xencenter could not connect to some of my xenservers today. This is an issue with Windows 10 and 512 bit certificates for old version of xenserver.
# My recently built servers have 1024 bit certs. My old servers that have been upgraded several times had 512 bit certs from original installations.
# All of my servers are running 6.5 so the generate_ssl_cert is already set to 1024 default. If you are using older version, modify the script.
# view strength of certificate. If it is 512 it needs to be rebuilt to allow connection from Windows 10.
openssl x509 -in /etc/xensource/xapi-ssl.pem -text
mv /etc/xensource/xapi-ssl.pem xapi-ssl.pem.orig
# By default xenserver uses the ip address for container name on certificate
/opt/xensource/libexec/generate_ssl_cert /etc/xensource/xapi-ssl.pem 10.1.2.42
xe-toolstack-restart
@gt50
gt50 / nxlog.conf
Created October 24, 2014 02:14
nxlog.conf for iis
## This is a sample configuration file. See the nxlog reference manual about the
## configuration options. It should be installed locally and is also available
## online at http://nxlog.org/nxlog-docs/en/nxlog-reference-manual.html
## Please set the ROOT to the folder your nxlog was installed into,
## otherwise it will not start.
#define ROOT C:\Program Files\nxlog
define ROOT C:\Program Files (x86)\nxlog
@gt50
gt50 / nxlog.conf
Created October 24, 2014 02:13
nxlog.conf for pacs
## This is a sample configuration file. See the nxlog reference manual about the
## configuration options. It should be installed locally and is also available
## online at http://nxlog.org/nxlog-docs/en/nxlog-reference-manual.html
## Please set the ROOT to the folder your nxlog was installed into,
## otherwise it will not start.
#define ROOT C:\Program Files\nxlog
define ROOT C:\Program Files (x86)\nxlog