This file contains hidden or 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
| #!/bin/bash | |
| # increase max open files | |
| echo -e "root soft nofile 32768\nroot hard nofile 32768" >> /etc/security/limits.conf | |
| echo -e "session required pam_limits.so" >> /etc/pam.d/common-session | |
| echo -e "session required pam_limits.so" >> /etc/pam.d/common-session-noninteractive | |
| # create swap | |
| fallocate -l 56G /mnt/swapfile | |
| chmod 600 /mnt/swapfile | |
| mkswap /mntswapfile | |
| swapon /mnt/swapfile |
This file contains hidden or 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
| server { | |
| # Workaround for multiple nginx conditions: | |
| # https://gist.github.com/jrom/1760790 | |
| ## White list dev machine ## | |
| if ($remote_addr = YOUR_IP_HERE) { | |
| set $flag isdev; | |
| } | |
| # Block wget/mozilla/ie/chrome agents |
This file contains hidden or 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 MySQLdb | |
| db = MySQLdb.connect("localhost", "user", "pw", "census") | |
| cursor = db.cursor() | |
| sql = 'INSERT INTO name (name, gender) VALUES (\'Bob\', \'M\')' | |
| try: | |
| cursor.execute(sql) | |
| db.commit() | |
| except: |
This file contains hidden or 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 MySQLdb | |
| db = MySQLdb.connect("localhost", "user", "pw", "census") | |
| cursor = db.cursor() | |
| sql = 'SELECT * FROM name' | |
| cursor.execute(sql) | |
| results = cursor.fetchall() | |
| print len(results) |
This file contains hidden or 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
| # MySQLdb - http://sourceforge.net/projects/mysql-python. Download MySQL-python-1.2.4b4.win32-py2.7.exe | |
| # MySQL 5.6 Community. Download mysql-installer-web-community-5.6.23.0 | |
| import MySQLdb | |
| db = MySQLdb.connect("localhost", "user", "pw") | |
| cursor = db.cursor() | |
| sql = 'CREATE DATABASE census' | |
| cursor.execute(sql) | |
| db.close() |
This file contains hidden or 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
| from __future__ import print_function | |
| from bs4 import BeautifulSoup | |
| from urlparse import urlparse | |
| from urlparse import parse_qs | |
| import sys, logging | |
| import mechanize | |
| import time | |
| import csv | |
| import sqlite3 | |
| import requests |
This file contains hidden or 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 java.util.Scanner; | |
| public class Power { | |
| public static int pow(int x, int n) { | |
| if (n == 0) | |
| return 1; | |
| else | |
| return x * pow(x, n-1); | |
| } |
This file contains hidden or 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 java.util.Scanner; | |
| import java.util.Arrays; | |
| public class Square { | |
| public static void drawSquare(int dim) { | |
| // Create an array with one string element to contain each row | |
| String arr[] = new String[dim]; | |
| Arrays.fill(arr, ""); | |
This file contains hidden or 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
| /** PROGRAM ASSIGNMENT 5 Animated.java | |
| * | |
| * Program Description | |
| * This is the Animated class, a subclass of the Movie class. | |
| * | |
| */ | |
| package library.films; | |
| public final class Animated extends Movie { |
This file contains hidden or 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
| /** PROGRAM ASSIGNMENT 5 CalebSabatiniP5.java | |
| * | |
| * Program Description | |
| * This is the client code for the Movie class and its subclasses, which | |
| * allows the user to navigate a Warren movie theater menu. | |
| * | |
| */ | |
| import library.films.*; | |
| import java.util.Scanner; |