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
| [array]$osNameObject = $null | |
| $vmHosts = Get-VMHost | |
| $i = 0 | |
| foreach ($h in $vmHosts) { | |
| Write-Progress -Activity "Going through each host in $vCenter..." -Status "Current Host: $h" -PercentComplete ($i/$vmHosts.Count*100) | |
| $osName = ($h | Get-VM | Get-View).Summary.Config.GuestFullName | |
| [array]$guestOSList += $osName | |
| Write-Verbose "Found OS: $osName" |
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
| #!/usr/bin/env python | |
| import random | |
| misketDict = { | |
| 'kirmizi' : 4, | |
| 'yesil' : 3, | |
| 'mavi' : 6, | |
| 'kahverengi' : 10, | |
| 'turuncu' : 4 |
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
| sudo apt-get install postgresql-9.6 postgresql-server-dev-9.6 postgresql-contrib-9.6 -y | |
| sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'" | |
| sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'" | |
| sudo systemctl stop postgresql | |
| sudo su - postgres -c '/usr/lib/postgresql/9.6/bin/pg_upgrade -b /usr/lib/postgresql/9.3/bin -B /usr/lib/postgresql/9.6/bin \ | |
| -d /var/lib/postgresql/9.3/main/ -D /var/lib/postgresql/9.6/main/ \ | |
| -O "-c config_file=/etc/postgresql/9.6/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" --link' | |
| sudo apt-get remove postgresql-9.3 -y |
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
| CREATE OR REPLACE FUNCTION fib(n integer) | |
| RETURNS INTEGER | |
| AS $$ | |
| DECLARE | |
| counter integer := 0; | |
| a integer := 0; | |
| b integer := 1; | |
| BEGIN | |
| IF (n < 1) THEN | |
| RETURN 0; |
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
| def conn(): | |
| return "host='ahost' dbname='adatabase' user='auser' port=5432 password='apassword'" |
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 psycopg2 | |
| import sys | |
| import pprint | |
| # file import | |
| import myconnect as m | |
| def main(): | |
| conn_string = m.conn() | |
| # print the connection string we will use to connect | |
| print "Connecting to database\n ->%s" % (conn_string) |
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
| CREATE OR REPLACE FUNCTION insert_date(INTEGER,INTEGER,DATE) RETURNS VOID AS $$ | |
| DECLARE | |
| mystart alias for $1; | |
| myend alias for $2; | |
| mydate alias for $3; | |
| BEGIN | |
| FOR i IN mystart..myend LOOP | |
| INSERT INTO impressions_by_day values(i,mydate,round(random()*10000)); | |
| END LOOP; | |
| END; |
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
| CREATE OR REPLACE FUNCTION fnsomefunc() | |
| RETURNS void AS | |
| $$ | |
| BEGIN | |
| FOR i IN 1 .. 100 LOOP | |
| RAISE NOTICE 'I am counting %',i; | |
| END LOOP; | |
| END; | |
| $$ | |
| LANGUAGE 'plpgsql' IMMUTABLE; |
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
| # See https://wiki.postgresql.org/wiki/Using_pg_upgrade_on_Ubuntu/Debian for more information and warning! | |
| # Check first | |
| /usr/lib/postgresql/11/bin/pg_upgrade \ | |
| -b /usr/lib/postgresql/9.6/bin \ | |
| -B /usr/lib/postgresql/11/bin \ | |
| -d /var/lib/postgresql/9.6/main \ | |
| -D /var/lib/postgresql/11/main \ | |
| -o ' -c config_file=/etc/postgresql/9.6/main/postgresql.conf' \ | |
| -O ' -c config_file=/etc/postgresql/11/main/postgresql.conf' \ |
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 matplotlib import pyplot as plt | |
| from matplotlib import style | |
| import numpy as np | |
| # print(style.available) | |
| #['seaborn-colorblind', 'seaborn-poster', 'grayscale', 'ggplot', 'seaborn-darkgrid', 'seaborn', 'seaborn-ticks', 'seaborn-white', 'seaborn-notebook', 'seaborn-whitegrid', 'seaborn-dark-palette', 'bmh', 'dark_background', 'seaborn-dark', 'seaborn-pastel', 'seaborn-muted', 'seaborn-paper', 'seaborn-talk', 'classic', 'seaborn-deep', 'seaborn-bright', 'fivethirtyeight'] | |
| style.use('ggplot') | |
| x,y = np.loadtxt('data.csv',unpack=True,delimiter=',') |