# Python Programming
## While loops
#### Kristof Michiels
## Introducing while Loops
The for loop takes a collection of items and executes a block of code once for each item in the collection. In contrast, the while loop runs as long as, or while, a certain condition is true.
The programs you use every day most likely contain while loops. For example, a game needs a while loop to keep running as long as you want to keep playing, and so it can stop running as soon as you ask it to quit. Programs wouldn’t be fun to use if they stopped running before we told them to or kept running even after we wanted to quit, so while loops are quite useful.
## The while Loop in Action
You can use a while loop to count up through a series of numbers. For example, the following while loop counts from 1 to 5:
```Python
current_number = 1
while current_number <= 5:
print(current_number)
current_number += 1
```
## Using a flag
For a program that should run only as long as many conditions are true, you can define one variable that determines whether or not the entire program is active. This variable, called a flag, acts as a signal to the program. We can write our programs so they run while the flag is set to True and stop running when any of several events sets the value of the flag to False.
When any of these events causes the active flag to become False, the main game loop will exit, a Game Over message can be displayed, and the player can be given the option to play again.
```Python
prompt = "\nTell me something, and I will repeat it back to you:"
prompt += "\nEnter 'quit' to end the program. "
active = True
while active:
message = input(prompt)
if message == 'quit':
active = False
else:
print(message)
## Using break to Exit a Loop
To exit a while loop immediately without running any remaining code in the loop, regardless of the results of any conditional test, use the break statement. The break statement directs the flow of your program; you can use it to control which lines of code are executed and which aren’t, so the program only executes code that you want it to, when you want it to.
A loop that starts with while True u will run forever unless it reaches a break statement. The loop in this program continues asking the user to enter the names of cities they’ve been to until they enter 'quit'. When they enter 'quit', the break statement runs, causing Python to exit the loop:
You can use the break statement in any of Python’s loops. For example, you could use break to quit a for loop that’s working through a list or a dictionary.
```Python
prompt = "\nPlease enter the name of a city you have visited:"
prompt += "\n(Enter 'quit' when you are finished.) "
while True:
city = input(prompt)
if city == 'quit':
break
else:
print(f"I'd love to go to {city.title()}!")
```
## Using continue in a Loop
Rather than breaking out of a loop entirely without executing the rest of its code, you can use the continue statement to return to the beginning of the loop based on the result of a conditional test.
```Python
current_number = 0
while current_number < 10:
current_number += 1
if current_number % 2 == 0:
continue
print(current_number)
```
## Avoiding Infinite Loops
Every while loop needs a way to stop running so it won’t continue to run forever.
if you accidentally omit the line x += 1 (as shown next), the loop will run forever:
```Python
# This loop runs forever!
x = 1
while x <= 5:
print(x)
## Using a while Loop with Lists and Dictionaries
So far, we’ve worked with only one piece of user information at a time. We received the user’s input and then printed the input or a response to it. The next time through the while loop, we’d receive another input value and respond to that. But to keep track of many users and pieces of information, we’ll need to use lists and dictionaries with our while loops.
A for loop is effective for looping through a list, but you shouldn’t modify a list inside a for loop because Python will have trouble keeping track of the items in the list. To modify a list as you work through it, use a while loop. Using while loops with lists and dictionaries allows you to collect, store, and organize lots of input to examine and report on later.
## Moving Items from One List to Another
Consider a list of newly registered but unverified users of a website. After we verify these users, how can we move them to a separate list of confirmed users? One way would be to use a while loop to pull users from the list of unconfirmed users as we verify them and then add them to a separate list of confirmed users.
```Python
unconfirmed_users = ['alice', 'brian', 'candace']
confirmed_users = []
while unconfirmed_users:
current_user = unconfirmed_users.pop()
print(f"Verifying user: {current_user.title()}")
confirmed_users.append(current_user)
print("\nThe following users have been confirmed:")
for confirmed_user in confirmed_users:
print(confirmed_user.title())
```
## Removing All Instances of Specific Values from a List
How to remove all instances of a value from a list?
```Python
pets = ['dog', 'cat', 'dog', 'goldfish', 'cat', 'rabbit', 'cat']
print(pets)
while 'cat' in pets:
pets.remove('cat')
print(pets)
```
## Filling a Dictionary with User Input
You can prompt for as much input as you need in each pass through a while loop. Let’s make a polling program in which each pass through the loop prompts for the participant’s name and response. We’ll store the data we gather in a dictionary, because we want to connect each response with a particular user:
```Python
responses = {}
polling_active = True
while polling_active:
# Prompt for the person's name and response.
name = input("\nWhat is your name? ")
response = input("Which mountain would you like to climb someday? ")
# Store the response in the dictionary.
responses[name] = response
# Find out if anyone else is going to take the poll.
repeat = input("Would you like to let another person respond? (yes/ no) ")
if repeat == 'no':
polling_active = False
# Polling is complete. Show the results.
print("\n--- Poll Results ---")
for name, response in responses.items():
print(f"{name} would like to climb {response}.")
```
## Python Programming - les 6 - kristof.michiels01@ap.be


distri is a research linux distribution.
For an overview, see my “distri: a Linux distribution to research fast package management” article.


Pig Dice
Player vs Computer
Player vs Player
Player 1:
Player 2:
Submit
Your turn
Roll!
Hold!


{{ domainNameIsset }} is not available!
{{ domainNameIsset }} is available now for $19.99/year
No thanks, I like my HipRez domain


Having spent some time in Gimp creating ambiance wallpapers for my Jolla I thought it would be nice to have a fast and easy tool for doing so.
I soon found Croppic, a jQuery plugin for cropping pictures, and then JollaWall was created.
My original inspiration comes from this site, which explains why the dimensions of the image should be 540×1600 pixels.
I have previously made a package of wallpapers available here.
You can find the source on GitHub.
Contact


We run ads
No
Smoothness
Normal
Low
Picture size
100%
70%
50%
Estimated file size:
*It takes your browser power to generate,
so please review your device spec
to make sure the process goes smooth.
Generate
Download


Box Office Records > Domestic > All Movies > Cumulative > All Time Domestic
All Time Domestic Box Office (Rank 5,001-5,100)
See also: All Time Domestic Limited Release - All Time International - All Time Worldwide - All Time Domestic (Inf. Adj.) - Top 2016 Domestic - Top 2017 Domestic
This chart contains the top 100 movies based on the cumulative domestic box office.
Please see our All-Time Top Grossing Films Comparison for a comparison of the daily performance of all films released since 1980 that have earned more than $450 million at the domestic box office.
| Rank | Released | Movie | Domestic Box Office |
International Box Office |
Worldwide Box Office |
|---|---|---|---|---|---|
| 5,001 | 2004 | Suspect Zero | $8,712,564 | $0 | $8,712,564 |
| 5,002 | 1985 | Mischief | $8,700,000 | $0 | $8,700,000 |
| 5,003 | 1982 | If You Could See What I Hear | $8,693,512 | $0 | $8,693,512 |
| 5,004 | 1988 | Clean and Sober | $8,674,093 | $0 | $8,674,093 |
| 5,005 | 1992 | Once Upon a Crime… | $8,669,847 | $0 | $8,669,847 |
| 5,006 | 2009 | My Life in Ruins | $8,665,206 | $11,800,000 | $20,465,206 |
| 5,007 | 1985 | The Man With One Red Shoe | $8,645,411 | $0 | $8,645,411 |
| 5,008 | 1996 | Before and After | $8,642,118 | $0 | $8,642,118 |
| 5,009 | 1991 | Late for Dinner | $8,641,499 | $0 | $8,641,499 |
| 5,010 | 1985 | That Was Then… This is Now | $8,630,068 | $0 | $8,630,068 |
| 5,011 | 1985 | Secret Admirer | $8,622,757 | $0 | $8,622,757 |
| 5,012 | 1986 | Manhunter | $8,620,929 | $0 | $8,620,929 |
| 5,013 | 1984 | The Bounty | $8,613,462 | $0 | $8,613,462 |
| 5,014 | 1983 | The Year of Living Dangerously | $8,601,065 | $0 | $8,601,065 |
| 5,015 | 1988 | U2: Rattle and Hum | $8,600,823 | $0 | $8,600,823 |
| 5,016 | 2000 | Pollock | $8,596,914 | $1,960,377 | $10,557,291 |
| 5,017 | 2003 | Boat Trip | $8,586,376 | $6,347,337 | $14,933,713 |
| 5,018 | 2007 | Death at a Funeral | $8,580,428 | $38,210,000 | $46,790,428 |
| 5,019 | 1994 | The Puppet Masters | $8,579,626 | $0 | $8,579,626 |
| 5,020 | 1988 | High Spirits | $8,578,231 | $0 | $8,578,231 |
| 5,021 | 2017 | The Lost City of Z | $8,574,339 | $8,550,000 | $17,124,339 |
| 5,022 | 1996 | All Dogs Go To Heaven 2 | $8,556,572 | $0 | $8,556,572 |
| 5,023 | 1986 | Blue Velvet | $8,551,228 | $61,210 | $8,612,438 |
| 5,024 | 1986 | Care Bears Movie II: A New Generation | $8,540,346 | $0 | $8,540,346 |
| 5,025 | 1996 | The Rich Man's Wife | $8,538,318 | $0 | $8,538,318 |
| 5,026 | 2005 | An Unfinished Life | $8,535,575 | $10,000,000 | $18,535,575 |
| 5,027 | 1993 | Leprechaun | $8,533,294 | $0 | $8,533,294 |
| 5,028 | 1980 | The Big Brawl | $8,527,743 | $0 | $8,527,743 |
| 5,029 | 2010 | MacGruber | $8,525,600 | $104,295 | $8,629,895 |
| 5,030 | 2014 | The Quiet Ones | $8,509,867 | $9,903,937 | $18,413,804 |
| 5,031 | 2005 | Sharks 3D | $8,500,000 | $5,500,000 | $14,000,000 |
| 5,032 | 1991 | Nothing But Trouble | $8,479,793 | $0 | $8,479,793 |
| 5,033 | 1986 | Wise Guys | $8,475,466 | $0 | $8,475,466 |
| 5,034 | 2014 | Legends of Oz: Dorothy’s Return | $8,462,347 | $11,645,586 | $20,107,933 |
| 5,035 | 2003 | Les invasions barbares | $8,460,000 | $17,453,869 | $25,913,869 |
| 5,036 | 1983 | Tender Mercies | $8,443,124 | $0 | $8,443,124 |
| 5,037 | 2001 | John Carpenter's Ghosts of Mars | $8,434,601 | $0 | $8,434,601 |
| 5,038 | 1999 | Play it to the Bone | $8,427,204 | $0 | $8,427,204 |
| 5,039 | 1980 | The Awakening | $8,415,112 | $0 | $8,415,112 |
| 5,040 | 2015 | Amy | $8,413,144 | $15,370,314 | $23,783,458 |
| 5,041 | 1999 | Pushing Tin | $8,408,835 | $0 | $8,408,835 |
| 5,042 | 2008 | Sex Drive | $8,402,485 | $2,010,000 | $10,412,485 |
| 5,043 | 1950 | All About Eve | $8,400,000 | $0 | $8,400,000 |
| 5,044 | 1981 | Carbon Copy | $8,400,000 | $0 | $8,400,000 |
| 5,045 | 1984 | Country | $8,400,000 | $0 | $8,400,000 |
| 5,046 | 1979 | Meteor | $8,400,000 | $0 | $8,400,000 |
| 5,047 | 1949 | Pinky | $8,400,000 | $0 | $8,400,000 |
| 5,048 | 1991 | Body Parts | $8,398,855 | $0 | $8,398,855 |
| 5,049 | 2002 | The Importance of Being Earnest | $8,378,141 | $0 | $8,378,141 |
| 5,050 | 1988 | The Last Temptation of Christ | $8,373,585 | $0 | $8,373,585 |
| 5,051 | 1984 | Nineteen Eighty-Four | $8,368,371 | $0 | $8,368,371 |
| 5,052 | 1997 | Turbo: A Power Rangers Movie | $8,363,899 | $0 | $8,363,899 |
| 5,053 | 1986 | Something Wild | $8,362,000 | $0 | $8,362,000 |
| 5,054 | 2002 | Death to Smoochy | $8,355,815 | $18,247 | $8,374,062 |
| 5,055 | 1995 | Smoke | $8,353,284 | $5,500,000 | $13,853,284 |
| 5,056 | 1998 | Return to Paradise | $8,352,677 | $0 | $8,352,677 |
| 5,057 | 1987 | Mitt liv som hund | $8,345,266 | $0 | $8,345,266 |
| 5,058 | 2006 | Tenacious D in: The Pick of Destiny | $8,334,575 | $5,100,000 | $13,434,575 |
| 5,059 | 1999 | Twin Dragons | $8,332,431 | $0 | $8,332,431 |
| 5,060 | 2005 | The Man | $8,330,720 | $2,062,976 | $10,393,696 |
| 5,061 | 2013 | Mandela: Long Walk to Freedom | $8,323,085 | $21,567,317 | $29,890,402 |
| 5,062 | 1999 | The Love Letter | $8,322,608 | $0 | $8,322,608 |
| 5,063 | 1984 | Terror in the Aisles | $8,316,206 | $0 | $8,316,206 |
| 5,064 | 2011 | Johnny English Reborn | $8,305,970 | $156,233,690 | $164,539,660 |
| 5,065 | 1993 | Mr. Jones | $8,302,752 | $0 | $8,302,752 |
| 5,066 | 1996 | Larger Than Life | $8,295,903 | $0 | $8,295,903 |
| 5,067 | 2003 | The Cooler | $8,291,572 | $2,839,883 | $11,131,455 |
| 5,068 | 1992 | Bébé's Kids | $8,284,881 | $0 | $8,284,881 |
| 5,069 | 2000 | Shadow of the Vampire | $8,279,017 | $0 | $8,279,017 |
| 5,070 | 1999 | Todo sobre mi madre | $8,264,530 | $59,600,000 | $67,864,530 |
| 5,071 | 1988 | Satisfaction | $8,253,123 | $0 | $8,253,123 |
| 5,072 | 1992 | Christopher Columbus: The Discovery | $8,251,071 | $0 | $8,251,071 |
| 5,073 | 1988 | The Blob | $8,247,943 | $0 | $8,247,943 |
| 5,074 | 1995 | Tall Tale | $8,247,627 | $0 | $8,247,627 |
| 5,075 | 2017 | The Promise | $8,224,288 | $1,780,577 | $10,004,865 |
| 5,076 | 1991 | Black Robe | $8,211,952 | $0 | $8,211,952 |
| 5,077 | 1992 | Gladiator | $8,205,703 | $0 | $8,205,703 |
| 5,078 | 1992 | Dr. Giggles | $8,205,290 | $0 | $8,205,290 |
| 5,079 | 1953 | Hondo | $8,200,000 | $0 | $8,200,000 |
| 5,080 | 1986 | Lucas | $8,200,000 | $0 | $8,200,000 |
| 5,081 | 1971 | McCabe & Mrs. Miller | $8,200,000 | $0 | $8,200,000 |
| 5,082 | 1961 | The Misfits | $8,200,000 | $0 | $8,200,000 |
| 5,083 | 2008 | Cadillac Records | $8,195,551 | $746,965 | $8,942,516 |
| 5,084 | 1983 | The House on Sorority Row | $8,184,633 | $0 | $8,184,633 |
| 5,085 | 2015 | Bajrangi Bhaijaan | $8,178,001 | $68,685,556 | $76,863,557 |
| 5,086 | 1997 | A Simple Wish | $8,165,213 | $0 | $8,165,213 |
| 5,087 | 2007 | Code Name: The Cleaner | $8,135,024 | $0 | $8,135,024 |
| 5,088 | 2007 | Delta Farce | $8,130,530 | $605,378 | $8,735,908 |
| 5,089 | 1990 | Funny About Love | $8,128,773 | $0 | $8,128,773 |
| 5,090 | 1948 | Key Largo | $8,125,000 | $3,986 | $8,128,986 |
| 5,091 | 1998 | Firestorm | $8,123,860 | $0 | $8,123,860 |
| 5,092 | 1962 | Days of Wine and Roses | $8,123,077 | $0 | $8,123,077 |
| 5,093 | 2005 | Mad Hot Ballroom | $8,117,961 | $1,269,620 | $9,387,581 |
| 5,094 | 2006 | Hoot | $8,117,637 | $107,361 | $8,224,998 |
| 5,095 | 2009 | The Road | $8,114,270 | $21,092,462 | $29,206,732 |
| 5,096 | 2003 | Dirty Pretty Things | $8,112,414 | $6,044,339 | $14,156,753 |
| 5,097 | 2014 | Inherent Vice | $8,110,975 | $581,923 | $8,692,898 |
| 5,098 | 2013 | Before Midnight | $8,110,621 | $15,182,425 | $23,293,046 |
| 5,099 | 2017 | A Cure for Wellness | $8,106,986 | $16,392,915 | $24,499,901 |
| 5,100 | 1984 | The Philadelphia Experiment | $8,103,330 | $0 | $8,103,330 |
The Domestic Market is defined as the North American movie territory (consisting of the United States, Canada, Puerto Rico and Guam).
This table is updated daily to reflect the latest studio reports.
Note: This chart is not adjusted for inflation.


WITNESS LIST Regulated Industries Committee March 25, 2003-2:00P HB 1750 For: Caldwell, Jim (Texas Silver Haired Legislature) Against: Hinkle, Ron (Verizon Wireless) Ratliff, Thomas (AT&T Wireless, Western Wireless and Texas Association of Paging Services) Registering, but not testifying: For: Effenberger, Barbara (Texas Silver Haired Legislature) Higgins, Carlos (Texas Silver Haired Legislature) Smith, Tom (Public Citizen) Against: Flores, Henry (Sprint) Grover, Jim (Texas Telephone Association) Lawson, Richard (Verizon Southwest) HB 1942 For: Coffin, Ann (Texas Interstate Pipeline Association) Hawkins, Tom (Atmos Energy Corporation) Rima, Bob (Texas Association of Builders) Seidlits, Curtis (TXU Corp.) Against: Gay, Geoffrey (Texas Coalition of Cities for Utility Issues Steering Committee of Cities Served by TXU) Lawton, Daniel (Cities of Denton, Greenville and Gatesville) Wojnowski, Matthew (City of Temple) On: Nalepa, Karl (Texas Railroad Commission) Registering, but not testifying: For: Gill, David (TXU Gas) Leverty, Don (CoServ Gas) Norman, Scott (Texas Association of Builders) Nugent, Patrick (Texas Pipeline Association) Rick, Grundman (Texas Gas Service Company) Savio, Harry (Home Builders Association - Greater Austin) Against: Smith, Tom (Public Citizen) HB 2084 For: Hardage, Tim (Self and Texas Agricultural Aviation Association) Jennings, Carol (Self) Mitchell, George (M&M Air Service and Texas Ag Aviation Association) Payne, Patti (Self) Shields, Chris (Texas Agricultural Aviation Association) Against: Hinkle, Ron (Verizon Wireless) Ratliff, Thomas (AT&T Wireless, Western Wireless and Texas Association of Paging Services) Registering, but not testifying: For: Jennings, Bobby (Self) Against: Flores, Henry (Sprint) On: Fulton, David (Texas Department of Transportation)


This option controls the "Content-Disposition" HTTP header:
- When this box is checked, file metadata will be configured with "Content-Disposition: inline" indicating it can be displayed inside a Web page, or as a Web page.
- When this box is left unchecked, file metadata will be configured with "Content-Disposition: attachment" indicating it should be downloaded.


This page gives you an overview how to enable fat binaries generation for XCode Projects for Libraries.
To enable the fat binary generation (combined iphoneos and iphonesimulator binaries) for your XCode Library Project, you just have to specify the following into the pom.xml:
..... <build> <plugins> <plugin> <groupId>com.sap.prd.mobile.ios.mios</groupId> <artifactId>xcode-maven-plugin</artifactId> <executions> <execution> <id>fat-lib</id> <goals> <goal>package-fat-lib</goal> </goals> <phase>package</phase> <inherited>false</inherited> <configuration /> </execution> </executions> </plugin> ... </plugins> </build>


 We have nowhere to go but the pub. Doesn’t anyone care about us?”
These angry words of a gang kid in 1971 prompted George Farrington, the leader of a church youth group, to gather a caring group of people around him to see if there was something that could be done to meet the need of troubled, angry and disadvantaged youths who didn’t fit in with the community or the church youth group scene.
Open House began in 1971 to provide a safe place and positive activities for troubled young people – an alternative to the pub.
Over the years Open House has grown in many ways to offer opportunities to a diverse range of people. Open House has responded to community needs by providing friendship and support through activities for people (children, youth and adults) who are suffering loneliness, isolation, distress, anxiety, mental illness or struggling with addiction or dysfunction, or those who don’t fit in school or are wrestling with growing up issues.
We believe that the development of positive friendships and support help people grow through the struggles and circumstances of their lives.
Many of the original founders are still actively involved in Open House at volunteer, board or adviser level.
Having had several bases through the years, including a long period in Ivanhoe, Open House is now based at a former Uniting Church site in Macleod, Victoria just a five minute walk from the shops or railway station.
We have a large church hall, welcome centre – with full catering facilities, workshops, youth worker offices, and the former manse which we have converted to our administration and meeting centre. We also have large grounds which are being progressively converted into community space – both indoors and outdoors.


A 16-man board controls the affairs of the Nigerian Wrestling Federation for a 4-years term.
The president heads the board, with a secretary representing the federal ministry of sport, an athlete representative, as well as a diverse others from numerous bodies and organisations.
The current board members are as follows
| 1 | Hon. Baraladei Daniel Igali | -President |
|---|---|---|
| 2 | Prince. F.A.B Adenekan | -Vice President |
| 3 | Sir. Damian Ohaike | Technical Director |
| 4 | Almu Umar Lambu | Secretary |
| 5 | Mr Jackson Bidei | Sponsor Representative |
| 6 | Dr Jude Amadi | NAPHER-SD Representative |
| 7 | Chief Austin Edeze | International |
| 8 | Mr Philip Momoh | Technical Representative |
| 9 | Gen. Uthman O. Olatoye | ....... |
| 10 | Dr Odunola Bello | NAWIS Representative |
| 11 | Alhaji Habib Abubakar Umar | ..... |
| 12 | Hon. Albert Atiwucha | ....... |
| 13 | Mr. Chris Yaba Amkpila | North Central Representative |
| 14 | Amas Daniel | Athlete Representative |
| 15 | Mrs. Onwe Chjinenye Beatrice | South East Representative |
| 16 | Air. Comodor N.E Caimdy | ........ |
The national team is composed of the Freestyle, Greco Roman and Women-wrestling teams. each of the team has a Coach an an assistant overseeing it affairs.
| 1 | Victor Kodei | Coach |
|---|---|---|
| 2 | Welson Ebikewenimo | 57kg |
| 3 | Kolawale Fisayo | 61kg |
| 4 | Amas Daniel | 65kg |
| 5 | Clarkson Sampson | 70kg |
| 6 | Ogbonna John | 74kg |
| 7 | Agiomor Ekrekeme | 78kg |
| 8 | Melvin Bibo | 86kg |
| 9 | Soso Tamarau | 97kg |
| 10 | Sinivie Boltic | 125kg |
| 1 | Godswill Tiebiri | Coach |
|---|---|---|
| 2 | Robinson Ikechukwu | 60kg |
| 3 | Pakistan Alfred | 67kg |
| 4 | Nworie Emanuel | 77kg |
| 5 | Okeke Tochukwu | 87kg |
| 1 | Akuh Purity | Coach |
|---|---|---|
| 2 | Genesis Mercy | 50kg |
| 3 | Bose Samuel | 53kg |
| 4 | Kolawale Esther | 55kg |
| 5 | Adekuoroye Odunayo | 57kg |
| 6 | Aminat Adeniyi | 62kg |
| 7 | Hannah Reuben | 65kg |
| 8 | Makanjola Bisola | 69kg |
| 9 | Oborodudu Blessing | 68kg |
| 10 | Balogun Sunmkisola | 72kg |
| 11 | Onyebuchi Joy Blessing | 75kg |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque interdum quam odio, quis placerat ante luctus eu. Sed aliquet dolor id sapien rutrum, id vulputate quam iaculis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque interdum quam odio, quis placerat ante luctus eu. Sed aliquet dolor id sapien rutrum, id vulputate quam iaculis.


ModSecurity
This example demonstrates how to configure ModSecurity web application firewall on HAProxy Ingress controller.
Prerequisites
This document has the following prerequisites:
- A Kubernetes cluster with a running HAProxy Ingress controller. See the five minutes deployment or the deployment example
ingress-controller
namespace, the default of the five minutes deployment
Deploying agent
A ModSecurity agent can be deployed in a number of ways: as a sidecar container in the same HAProxy Ingress deployment/daemonset resource, as a standalone container in the same host of ingress, or in dedicated host(s), inside or outside a k8s cluster. The steps below will deploy ModSecurity in some dedicated hosts of a k8s cluster, adjust the steps to fit your need.
The ModSecurity agent used is jcmoraisjr/modsecurity-spoa.
Create the ModSecurity agent deployment with 3 running pods:
$ kubectl create -f https://haproxy-ingress.github.io/resources/modsecurity-deployment.yaml
deployment.apps/modsecurity-spoa created
Note
This deployment configures a small amount of requests and limits resources, remember to adjust them before moving to production.Check if the agent is up and running:
$ kubectl -n ingress-controller get deployment modsecurity-spoa
NAME READY UP-TO-DATE AVAILABLE AGE
modsecurity-spoa 3/3 3 3 7s
You can now create the service that provides a ClusterIP address for the HAProxy ConfigMap.
$ kubectl -n ingress-controller expose deployment modsecurity-spoa --port=12345 --type=ClusterIP
service/modsecurity-spoa exposed
Once the service is created, you can obtain the ClusterIP address to be used later in the ConfigMap.
$ kubectl -n ingress-controller get service modsecurity-spoa
NAME TYPE CLUSTERIP EXTERNAL-IP PORT(S) AGE
modsecurity-spoa ClusterIP <IP_ADDRESS> <none> 12345/TCP 7m
Configuring HAProxy Ingress
Add the ConfigMap key modsecurity-endpoints
with a comma-separated list of IP:port
of the ModSecurity agent server(s). The default port number of the agent is 12345
.
A kubectl -n ingress-controller edit configmap haproxy-ingress
should work.
Example of a ConfigMap content if the ModSecurity service has a ClusterIP of <IP_ADDRESS>
:
apiVersion: v1
data:
modsecurity-endpoints: <IP_ADDRESS>:12345
...
kind: ConfigMap
Test
Deploy any application:
$ kubectl run echo \
--image=gcr.io/google_containers/echoserver:1.3 \
--port=8080 \
--expose
… and create its ingress resource. Remember to annotate waf as modsecurity
.
No need to use a valid domain, echo.domain
below is fine:
$ kubectl create -f - <<EOF
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
haproxy-ingress.github.io/ssl-redirect: "false"
haproxy-ingress.github.io/waf: "modsecurity"
name: echo
spec:
rules:
- host: echo.domain
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: echo
port:
number: 8080
EOF
Test with a simple request. Change the IP below to the IP of your Ingress controller:
$ curl -I <IP_ADDRESS> -H 'Host: echo.domain'
HTTP/1.1 200 OK
Server: nginx/1.9.11
Date: Sun, 27 May 2018 23:28:58 GMT
Content-Type: text/plain
Test now with a malicious request:
curl -i '<IP_ADDRESS>?p=/etc/passwd' -H 'Host: echo.domain'
HTTP/1.0 403 Forbidden
Cache-Control: no-cache
Connection: close
Content-Type: text/html

403 Forbidden

Request forbidden by administrative rules.

Check the agent logs:
$ kubectl -n ingress-controller get pod -lrun=modsecurity-spoa
NAME READY STATUS RESTARTS AGE
modsecurity-spoa-6f757ffd88-9qt2f 1/1 Running 0 11m
modsecurity-spoa-6f757ffd88-vwtzr 1/1 Running 0 11m
modsecurity-spoa-6f757ffd88-q4rvm 1/1 Running 0 11m
...
$ kubectl -n ingress-controller logs --tail=10 modsecurity-spoa-6f757ffd88-9qt2f
...
1527464273.942819 [00] [client <IP_ADDRESS>] ModSecurity: Access denied with code 403 (phase 2). Matche
d phrase "etc/passwd" at ARGS:p. [file "/etc/modsecurity/owasp-modsecurity-crs/rules/REQUEST-930-APP
LICATION-ATTACK-LFI.conf"] [line "108"] [id "930120"] [rev "4"] [msg "OS File Access Attempt"] [data
"Matched Data: etc/passwd found within ARGS:p: /etc/passwd"] [severity "CRITICAL"] [ver "OWASP_CRS/
3.0.0"] [maturity "9"] [accuracy "9"] [tag "application-multi"] [tag "language-multi"] [tag "platfor
m-multi"] [tag "attack-lfi"] [tag "OWASP_CRS/WEB_ATTACK/FILE_INJECTION"] [tag "WASCTC/WASC-33"] [tag
"OWASP_TOP_10/A4"] [tag "PCI/6.5.4"] [hostname "ingress.localdomain"] [uri "http://echo.domain/"] [
unique_id ""]
...
Deploy ModSecurity Agent With a Sidecar Container for Audit Logs
A ModSecurity agent can be deployed with an additional sidecar container so you can have access to the logs stored in the AuditLog file. If you are using the default configuration of the ModSecurity agent, the logs written to the AuditLog specified are not reachable in the agent container’s STDOUT.
In order to read information written to that file, you must add a sidecar container to the method of deployment of the ModSecurity agent in Kubernetes. This is especially useful if you set the SecRuleEngine configuration to DetectionOnly.
Update the ModSecurity agent deployment to have a sidecar container to read the audit log file to STDOUT
$ kubectl apply -f https://haproxy-ingress.github.io/resources/modsecurity-deployment-auditlog-sidecar.yaml
deployment "modsecurity-spoa" configured
Now the ModSecurity agent pods will have two containers to get logs from: one for the traditional ModSecurity logs and one for the logs written to the AuditLog file.
$ kubectl -n ingress-controller get pod -lrun=modsecurity-spoa
NAME READY STATUS RESTARTS AGE
modsecurity-spoa-6596c6b444-cht27 2/2 Running 0 14m
modsecurity-spoa-6596c6b444-kw2tr 2/2 Running 0 14m
modsecurity-spoa-6596c6b444-mkndw 2/2 Running 0 14m
Using Coraza instead of ModSecurity
Since the maintainers of ModSecurity are dropping support in 2024, OWASP has created a replacement called Coraza which is a drop-in replacement for ModSecurity.
In order to use Coraza, the process is essentially the same as described in the above sections, with a few exceptions. First, in the haproxy-ingress ConfigMap, add the following two additional keys:
modsecurity-use-coraza: true
modsecurity-args: "app=hdr(host) id=unique-id src-ip=src src-port=src_port dst-ip=dst dst-port=dst_port method=method path=path query=query version=req.ver headers=req.hdrs body=req.body"
You may require different modsecurity-args
depending on your Coraza config and your version of coraza-spoa. Check the coraza-spoa README for full details.
Second, you’ll need to change the spoa-modsecurity container image to a coraza-spoa image and create a configmap to hold the Coraza config.yaml. A complete example with all the changes can be found here.
Warning
The coraza-spoa image that we provide in the above example is based on an experimental branch of coraza-spoa. For production environments, it would be best to wait until the experimental changes are merged and an official image is released.Troubleshooting Coraza
- Ensure that the
bind
port in Coraza’s config.yaml matches the port inmodsecurity-endpoints
. - Pay close attention to the
modsecurity-args
(specifically theapp
arg) and make sure they are set according to the coraza-spoa docs since the exact args may vary depending on your version of coraza-spoa. - For more complex issues, it may help to set
log_level: debug
in Coraza.


Ethanol reduces your miles per gallon (mpg) compared to gasoline that contains no ethanol, based on the energy output of ethanol vs gasoline. This calculator compares value based on price per gallon of gas.
For example, if normal non-ethanol gas is $3.499, then for E85 to provide more miles per dollar the price must be less than $2.482; E15 would give more miles per dollar when less than $3.319; and E10 would give more miles per dollar when less than $3.379)
Higher Octane gas will NOT improve your miles per gallon (mpg) even though it is more expensive. (More details at Scientific American, or CarTalk.com)
So buy the lowest Octane that your car is rated for. Anything higher will not hurt your car but also will not help your car, so you would probably be wasting money. Most US cars take 87 octane, except for luxury brands like Cadillac, BMW, Mercedes, etc that often require 91 octane. (or 85 and 89 respectively in high altitude Mountain areas)
You have 2 choices if the price at the pump is within pennies of the calculated best price.
GasPumpr calculations are purely informational and economical. Other online resources show the pros/cons of ethanol effects on your engine, along with additional environmental benefits, or even the political effects of ethanol subsidies. Your actual miles per gallon may vary slightly from this generic calculation. See the published mpg and E85 mpg of your car at fueleconomy.gov
Even though this calculator is displayed in US-dollars, the calculation is the same for any currency. Just ignore the dollar sign and the results are fine if you are trying this calculation in Mexico, Canada, Europe, etc...
The original gaspumpr.com web site is still available and designed for mobile use.
Conversion factors in this app are from US Dept of Energy - Alternative Fuels Data Center - "Clean Cities Alternative Fuel Price Report", April 2012 PDF
Initial thoughts were generated by a Consumer Reports article "The great ethanol debate", January 2011
Gas pump logo from fatcow. Gas pump app icon from Visual Pharm.


Login:
Email:
First name:
Second name:
Birth date:
Mobile number:
Ticket id
Departure date
Departure time
Arrival date
Arrival time


Company name is required.
Company Email address is required.
Company Email address is invalid.
Password is required.
{{passwordError}}


YoungInnovations Blog
We develop innovative solutions! But we take pride in making solutions work and create impact!!
Email
Twitter
Facebook
Github
Well I’m going to present today at the 14th PHP developers meetup. I will be talking about Automated Unit Testing and Continuous Integration. I am going to be explaining about why testing, in general is important, the features of unit tests and why CI is cool.
Automated tests with phpunit is a puzzle, CI is the missing piece
We have a trend of celebrating Birthday at the end of every month. So, on 31st of August, we celebrated the Birthday of five of us: Prashant Shrestha, Nirajan Basnet, Lunek Suwal, Sachit Bir Singh Dangol, Manoj Byanjankar.
We made our smoke testing library hookah open source last week.
We are currently using it to test some web applications we have built using Laravel. Though Laravel testing is more expressive, hookah is just a smoke testing library which can be used in any framework or even
language as long as there is a login form with 2 fields and a submit button. In this post I will reveal
how to integrate Hookah with Laravel 5.x.
On August 22, Saturday, Ncell App Camp 2015 debriefing session was organized at Hotel Himalaya, Pulchowk. More than 300 students, developers and mobile enthusiasts participated altogether in 2 sessions. This week’s Knowledge Sharing Wednesday featured Alina Acharya ,Data Analyst, who presented on our earthquake fund tracking portal.
What is the difference between Ncell App Camp 2014 and Ncell App Camp 2015? There is more than one difference, most definitely. But, heightened anticipation, is something I’d mention with certainty. With the incredible success last year, this year’s event is being looked upon with much enthusiasm (and scrutiny) and we are excited to present to you every phase of the five month long journey.


Vist
681
Unique Vistors
522
Page Views
1,622
Bounce Rate
843
BROWSER FLOW
| # | Browser | Vists |
|---|---|---|
| Chrome | 11,976 | |
| Firefox | 1,706 | |
| Safari | 1,677 | |
| Internet | 1,268 | |
| Opera | 915 |
VISTS IN DIFFERENT COUNTRIES
| Language | Vists | %Vists |
|---|---|---|
| U.S.A | 12,924 |
|
| U.K | 11,246 |
|
| Canada | 10,468 |
|
| Germany | 8,246 |
|
| China | 4,354 |
|
| Australia | 3,675 |
|


{% load staticfiles %}
Our servers will run the matchin algorithm daily. You will be informed via email when you have been successfully matched


Hey John and Jordan,
Thank you for speaking with me today! I really like what VaynerMedia is about and what it has to offer. I am excited about the opportunity to become a valuable contributor to the team. As a junior developer, there will be a lot to learn so expect me to be there at the office as long as you guys are there.
Sincerely,
Sunny Chao
P.S. click-->


Twitter Bio Prompt
Get Noticed
Use the prompts below to spark a little creativity in crafting your 160 character Twitter bio.


Coin Dragon issues your coins' value to the charity foundation/organisation of your choice.
Full Disclosure: While there is no service fee incured the end users, for each charity option,
Coin Dragon collects a small fee from our partners to subsidise for our operating cost.
You have the right to decline this Service by pressing ‘Start Over’ before proceeding to deposit any coins into the kiosk.
Coin Dragon is not performing the functions of and is not licensed as a bank or deposit-taking company.
Only HKD coins are accepted for this Service.
If you deposit any items other than HKD coins, for example, counterfeit coins, foreign coins or foreign objects, into the kiosk,
Coin Dragon shall have no responsibility to return these items to you or to proceed with any add value transaction.
Please note: Once coins have been deposited, transaction cannot be cancelled and coins cannot be returned.
Receipts for this Service are available in digital formats only: Screen Display, Email, or SMS.
The Coin Dragon team takes user privacy very seriously.
Any of your personal information provided by you for this Service is used only for the purpose and intent of delivering you your coins’ value
according to the coins conversion option(s) you choose.
We do not share this information with OCL or any other third parties or use it for any other purposes.
Our data transmission is used over SSL-encryption connectivity to maximize our data integrity and security.


iReporter
Login
Sign Up
Welcome to
iReporter
!
Building a better nation starts with you
WHISTLE BLOW


Third Party Modules¶
securecrt_tools.textfsm¶
Template based text parser.
This module implements a parser, intended to be used for converting human readable text, such as command output from a router CLI, into a list of records, containing values extracted from the input text.
A simple template language is used to describe a state machine to parse a specific type of text input, returning a record of values for each input entity.
-
class
securecrt_tools.textfsm.
CopyableRegexObject
(pattern)¶ Bases:
object
Like a re.RegexObject, but can be copied.
-
match
(*args, **kwargs)¶
-
sub
(*args, **kwargs)¶
-
-
exception
securecrt_tools.textfsm.
Error
¶ Bases:
exceptions.Exception
Base class for errors.
-
exception
securecrt_tools.textfsm.
FSMAction
¶ Bases:
exceptions.Exception
Base class for actions raised with the FSM.
-
exception
securecrt_tools.textfsm.
SkipRecord
¶ Bases:
securecrt_tools.textfsm.FSMAction
Indicate a record is to be skipped.
-
exception
securecrt_tools.textfsm.
SkipValue
¶ Bases:
securecrt_tools.textfsm.FSMAction
Indicate a value is to be skipped.
-
class
securecrt_tools.textfsm.
TextFSM
(template, options_class=<class 'securecrt_tools.textfsm.TextFSMOptions'>)¶ Bases:
object
Parses template and creates Finite State Machine (FSM).
- Attributes:
- states: (str), Dictionary of FSMState objects. values: (str), List of FSMVariables. value_map: (map), For substituting values for names in the expressions. header: Ordered list of values. state_list: Ordered list of valid states.
-
GetValuesByAttrib
(attribute)¶ Returns the list of values that have a particular attribute.
-
MAX_NAME_LEN
= 48¶
-
ParseText
(text, eof=True)¶ Passes CLI output through FSM and returns list of tuples.
First tuple is the header, every subsequent tuple is a row.
- Args:
- text: (str), Text to parse with embedded newlines. eof: (boolean), Set to False if we are parsing only part of the file. Suppresses triggering EOF state.
- Raises:
- TextFSMError: An error occurred within the FSM.
- Returns:
- List of Lists.
-
Reset
()¶ Preserves FSM but resets starting state and current record.
-
comment_regex
= <_sre.SRE_Pattern object>¶
-
header
¶ Returns header.
-
state_name_re
= <_sre.SRE_Pattern object>¶
-
exception
securecrt_tools.textfsm.
TextFSMError
¶ Bases:
securecrt_tools.textfsm.Error
Error in the FSM state execution.
-
class
securecrt_tools.textfsm.
TextFSMOptions
¶ Bases:
object
Class containing all valid TextFSMValue options.
Each nested class here represents a TextFSM option. The format is “option<name>”. Each class may override any of the methods inside the OptionBase class.
A user of this module can extend options by subclassing TextFSMOptionsBase, adding the new option class(es), then passing that new class to the TextFSM constructor with the ‘option_class’ argument.
-
class
Filldown
(value)¶ Bases:
securecrt_tools.textfsm.OptionBase
Value defaults to the previous line’s value.
-
OnAssignVar
()¶ Called when a matched value is being assigned.
-
OnClearAllVar
()¶ Called when a value has clearalled.
-
OnClearVar
()¶ Called when value has been cleared.
-
OnCreateOptions
()¶ Called after all options have been parsed for a Value.
-
-
class
Fillup
(value)¶ Bases:
securecrt_tools.textfsm.OptionBase
Like Filldown, but upwards until it finds a non-empty entry.
-
OnAssignVar
()¶ Called when a matched value is being assigned.
-
-
classmethod
GetOption
(name)¶ Returns the class of the requested option name.
-
class
Key
(value)¶ Bases:
securecrt_tools.textfsm.OptionBase
Value constitutes part of the Key of the record.
-
class
List
(value)¶ Bases:
securecrt_tools.textfsm.OptionBase
Value takes the form of a list.
-
OnAssignVar
()¶ Called when a matched value is being assigned.
-
OnClearAllVar
()¶ Called when a value has clearalled.
-
OnClearVar
()¶ Called when value has been cleared.
-
OnCreateOptions
()¶ Called after all options have been parsed for a Value.
-
OnSaveRecord
()¶ Called just prior to a record being committed.
-
-
class
OptionBase
(value)¶ Bases:
object
Factory methods for option class.
- Attributes:
- value: A TextFSMValue, the parent Value.
-
OnAssignVar
()¶ Called when a matched value is being assigned.
-
OnClearAllVar
()¶ Called when a value has clearalled.
-
OnClearVar
()¶ Called when value has been cleared.
-
OnCreateOptions
()¶ Called after all options have been parsed for a Value.
-
OnGetValue
()¶ Called when the value name is being requested.
-
OnSaveRecord
()¶ Called just prior to a record being committed.
-
name
¶
-
class
Required
(value)¶ Bases:
securecrt_tools.textfsm.OptionBase
The Value must be non-empty for the row to be recorded.
-
OnSaveRecord
()¶ Called just prior to a record being committed.
-
-
classmethod
ValidOptions
()¶ Returns a list of valid option names.
-
class
-
class
securecrt_tools.textfsm.
TextFSMRule
(line, line_num=-1, var_map=None)¶ Bases:
object
A rule in each FSM state.
A value has syntax like:
^<regexp> -> Next.Record State2Where ‘<regexp>’ is a regular expression. ‘Next’ is a Line operator. ‘Record’ is a Record operator. ‘State2’ is the next State.
- Attributes:
- match: Regex to match this rule. regex: match after template substitution. line_op: Operator on input line on match. record_op: Operator on output record on match. new_state: Label to jump to on action regex_obj: Compiled regex for which the rule matches. line_num: Integer row number of Value.
-
ACTION2_RE
= <_sre.SRE_Pattern object>¶
-
ACTION3_RE
= <_sre.SRE_Pattern object>¶
-
ACTION_RE
= <_sre.SRE_Pattern object>¶
-
LINE_OP
= ('Continue', 'Next', 'Error')¶
-
LINE_OP_RE
= '(?P<ln_op>Continue|Next|Error)'¶
-
MATCH_ACTION
= <_sre.SRE_Pattern object>¶
-
NEWSTATE_RE
= '(?P<new_state>\\w+|\\".*\\")'¶
-
OPERATOR_RE
= '((?P<ln_op>Continue|Next|Error)(\\.(?P<rec_op>Clear|Clearall|Record|NoRecord))?)'¶
-
RECORD_OP
= ('Clear', 'Clearall', 'Record', 'NoRecord')¶
-
RECORD_OP_RE
= '(?P<rec_op>Clear|Clearall|Record|NoRecord)'¶
-
exception
securecrt_tools.textfsm.
TextFSMTemplateError
¶ Bases:
securecrt_tools.textfsm.Error
Errors while parsing templates.
-
class
securecrt_tools.textfsm.
TextFSMValue
(fsm=None, max_name_len=48, options_class=None)¶ Bases:
object
A TextFSM value.
A value has syntax like:
‘Value Filldown,Required helloworld (.*)’
Where ‘Value’ is a keyword. ‘Filldown’ and ‘Required’ are options. ‘helloworld’ is the value name. ‘(.*) is the regular expression to match in the input data.
- Attributes:
- max_name_len: (int), maximum character length os a variable name. name: (str), Name of the value. options: (list), A list of current Value Options. regex: (str), Regex which the value is matched on. template: (str), regexp with named groups added. fsm: A TextFSMBase(), the containing FSM. value: (str), the current value.
-
AssignVar
(value)¶ Assign a value to this Value.
-
ClearAllVar
()¶ Clear this Value.
-
ClearVar
()¶ Clear this Value.
-
Header
()¶ Fetch the header name of this Value.
-
OnSaveRecord
()¶ Called just prior to a record being committed.
-
OptionNames
()¶ Returns a list of option names for this Value.
-
Parse
(value)¶ Parse a ‘Value’ declaration.
- Args:
- value: String line from a template file, must begin with ‘Value ‘.
- Raises:
- TextFSMTemplateError: Value declaration contains an error.
-
exception
securecrt_tools.textfsm.
Usage
¶ Bases:
exceptions.Exception
Error in command line execution.
-
securecrt_tools.textfsm.
main
(argv=None)¶ Validate text parsed with FSM or validate an FSM via command line.
securecrt_tools.ipaddress¶
A fast, lightweight IPv4/IPv6 manipulation library in Python.
This library is used to create/poke/manipulate IPv4 and IPv6 addresses and networks.
-
exception
securecrt_tools.ipaddress.
AddressValueError
¶ Bases:
exceptions.ValueError
A Value Error related to the address.
-
class
securecrt_tools.ipaddress.
IPv4Address
(address)¶ Bases:
securecrt_tools.ipaddress._BaseV4
,securecrt_tools.ipaddress._BaseAddress
Represent and manipulate single IPv4 Addresses.
-
is_global
¶
-
is_link_local
¶ Test if the address is reserved for link-local.
- Returns:
- A boolean, True if the address is link-local per RFC 3927.
-
is_loopback
¶ Test if the address is a loopback address.
- Returns:
- A boolean, True if the address is a loopback per RFC 3330.
-
is_multicast
¶ Test if the address is reserved for multicast use.
- Returns:
- A boolean, True if the address is multicast. See RFC 3171 for details.
-
is_private
¶ Test if this address is allocated for private networks.
- Returns:
- A boolean, True if the address is reserved per iana-ipv4-special-registry.
-
is_reserved
¶ Test if the address is otherwise IETF reserved.
- Returns:
- A boolean, True if the address is within the reserved IPv4 Network range.
-
is_unspecified
¶ Test if the address is unspecified.
- Returns:
- A boolean, True if this is the unspecified address as defined in RFC 5735 3.
-
packed
¶ The binary representation of this address.
-
-
class
securecrt_tools.ipaddress.
IPv4Interface
(address)¶ Bases:
securecrt_tools.ipaddress.IPv4Address
-
ip
¶
-
with_hostmask
¶
-
with_netmask
¶
-
with_prefixlen
¶
-
-
class
securecrt_tools.ipaddress.
IPv4Network
(address, strict=True)¶ Bases:
securecrt_tools.ipaddress._BaseV4
,securecrt_tools.ipaddress._BaseNetwork
This class represents and manipulates 32-bit IPv4 network + addresses..
- Attributes: [examples for IPv4Network(‘<IP_ADDRESS>/27’)]
- .network_address: IPv4Address(‘<IP_ADDRESS>’) .hostmask: IPv4Address(‘<IP_ADDRESS>’) .broadcast_address: IPv4Address(‘<IP_ADDRESS>’) .netmask: IPv4Address(‘<IP_ADDRESS>’) .prefixlen: 27
-
is_global
¶ Test if this address is allocated for public networks.
- Returns:
- A boolean, True if the address is not reserved per iana-ipv4-special-registry.
-
class
securecrt_tools.ipaddress.
IPv6Address
(address)¶ Bases:
securecrt_tools.ipaddress._BaseV6
,securecrt_tools.ipaddress._BaseAddress
Represent and manipulate single IPv6 Addresses.
-
ipv4_mapped
¶ Return the IPv4 mapped address.
- Returns:
- If the IPv6 address is a v4 mapped address, return the IPv4 mapped address. Return None otherwise.
-
is_global
¶ Test if this address is allocated for public networks.
- Returns:
- A boolean, true if the address is not reserved per iana-ipv6-special-registry.
-
is_link_local
¶ Test if the address is reserved for link-local.
- Returns:
- A boolean, True if the address is reserved per RFC 4291.
-
is_loopback
¶ Test if the address is a loopback address.
- Returns:
- A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3.
-
is_multicast
¶ Test if the address is reserved for multicast use.
- Returns:
- A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details.
-
is_private
¶ Test if this address is allocated for private networks.
- Returns:
- A boolean, True if the address is reserved per iana-ipv6-special-registry.
-
is_reserved
¶ Test if the address is otherwise IETF reserved.
- Returns:
- A boolean, True if the address is within one of the reserved IPv6 Network ranges.
-
is_site_local
¶ Test if the address is reserved for site-local.
Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193.
- Returns:
- A boolean, True if the address is reserved per RFC 3513 2.5.6.
-
is_unspecified
¶ Test if the address is unspecified.
- Returns:
- A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2.
-
packed
¶ The binary representation of this address.
-
sixtofour
¶ Return the IPv4 6to4 embedded address.
- Returns:
- The IPv4 6to4-embedded address if present or None if the address doesn’t appear to contain a 6to4 embedded address.
-
teredo
¶ Tuple of embedded teredo IPs.
- Returns:
- Tuple of the (server, client) IPs or None if the address doesn’t appear to be a teredo address (doesn’t start with 2001::/32)
-
-
class
securecrt_tools.ipaddress.
IPv6Interface
(address)¶ Bases:
securecrt_tools.ipaddress.IPv6Address
-
ip
¶
-
is_loopback
¶
-
is_unspecified
¶
-
with_hostmask
¶
-
with_netmask
¶
-
with_prefixlen
¶
-
-
class
securecrt_tools.ipaddress.
IPv6Network
(address, strict=True)¶ Bases:
securecrt_tools.ipaddress._BaseV6
,securecrt_tools.ipaddress._BaseNetwork
This class represents and manipulates 128-bit IPv6 networks.
- Attributes: [examples for IPv6(‘2001:db8::1000/124’)]
- .network_address: IPv6Address(‘2001:db8::1000’) .hostmask: IPv6Address(‘::f’) .broadcast_address: IPv6Address(‘2001:db8::100f’) .netmask: IPv6Address(‘ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0’) .prefixlen: 124
-
hosts
()¶ Generate Iterator over usable hosts in a network.
This is like __iter__ except it doesn’t return the Subnet-Router anycast address.
-
is_site_local
¶ Test if the address is reserved for site-local.
Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193.
- Returns:
- A boolean, True if the address is reserved per RFC 3513 2.5.6.
-
exception
securecrt_tools.ipaddress.
NetmaskValueError
¶ Bases:
exceptions.ValueError
A Value Error related to the netmask.
-
securecrt_tools.ipaddress.
collapse_addresses
(addresses)¶ Collapse a list of IP objects.
- Example:
- collapse_addresses([IPv4Network(‘<IP_ADDRESS>/25’),
- IPv4Network(‘<IP_ADDRESS>/25’)]) -> [IPv4Network(‘<IP_ADDRESS>/24’)]
- Args:
- addresses: An iterator of IPv4Network or IPv6Network objects.
- Returns:
- An iterator of the collapsed IPv(4|6)Network objects.
- Raises:
- TypeError: If passed a list of mixed version objects.
-
securecrt_tools.ipaddress.
get_mixed_type_key
(obj)¶ Return a key suitable for sorting between networks and addresses.
Address and Network objects are not sortable by default; they’re fundamentally different so the expression
IPv4Address(‘<IP_ADDRESS>’) <= IPv4Network(‘<IP_ADDRESS>/24’)doesn’t make any sense. There are some times however, where you may wish to have ipaddress sort these for you anyway. If you need to do this, you can use this function as the key= argument to sorted().
- Args:
- obj: either a Network or Address object.
- Returns:
- appropriate key.
-
securecrt_tools.ipaddress.
ip_address
(address)¶ Take an IP string/int and return an object of the correct type.
- Args:
- address: A string or integer, the IP address. Either IPv4 or
- IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default.
- Returns:
- An IPv4Address or IPv6Address object.
- Raises:
- ValueError: if the address passed isn’t either a v4 or a v6
- address
-
securecrt_tools.ipaddress.
ip_interface
(address)¶ Take an IP string/int and return an object of the correct type.
- Args:
- address: A string or integer, the IP address. Either IPv4 or
- IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default.
- Returns:
- An IPv4Interface or IPv6Interface object.
- Raises:
- ValueError: if the string passed isn’t either a v4 or a v6
- address.
- Notes:
- The IPv?Interface classes describe an Address on a particular Network, so they’re basically a combination of both the Address and Network classes.
-
securecrt_tools.ipaddress.
ip_network
(address, strict=True)¶ Take an IP string/int and return an object of the correct type.
- Args:
- address: A string or integer, the IP network. Either IPv4 or
- IPv6 networks may be supplied; integers less than 2**32 will be considered to be IPv4 by default.
- Returns:
- An IPv4Network or IPv6Network object.
- Raises:
- ValueError: if the string passed isn’t either a v4 or a v6
- address. Or if the network has host bits set.
-
securecrt_tools.ipaddress.
summarize_address_range
(first, last)¶ Summarize a network range given the first and last IP addresses.
- Example:
>>> list(summarize_address_range(IPv4Address('<IP_ADDRESS>'), ... IPv4Address('<IP_ADDRESS>'))) ... #doctest: +NORMALIZE_WHITESPACE [IPv4Network('<IP_ADDRESS>/25'), IPv4Network('<IP_ADDRESS>/31'), IPv4Network('<IP_ADDRESS>/32')]
- Args:
- first: the first IPv4Address or IPv6Address in the range. last: the last IPv4Address or IPv6Address in the range.
- Returns:
- An iterator of the summarized IPv(4|6) network objects.
- Raise:
- TypeError:
- If the first and last objects are not IP addresses. If the first and last objects are not the same version.
- ValueError:
- If the last object is not greater than the first. If the version of the first address is not 4 or 6.
-
securecrt_tools.ipaddress.
v4_int_to_packed
(address)¶ Represent an address as 4 packed bytes in network (big-endian) order.
- Args:
- address: An integer representation of an IPv4 IP address.
- Returns:
- The integer address packed as 4 bytes in network (big-endian) order.
- Raises:
- ValueError: If the integer is negative or too large to be an
- IPv4 IP address.
-
securecrt_tools.ipaddress.
v6_int_to_packed
(address)¶ Represent an address as 16 packed bytes in network (big-endian) order.
- Args:
- address: An integer representation of an IPv6 IP address.
- Returns:
- The integer address packed as 16 bytes in network (big-endian) order.
securecrt_tools.manuf¶
Parser library for Wireshark’s OUI database.
Converts MAC addresses into a manufacturer using Wireshark’s OUI database.
See README.md.
-
class
securecrt_tools.manuf.
MacParser
(manuf_name='manuf', update=False)¶ Bases:
object
Class that contains a parser for Wireshark’s OUI database.
Optimized for quick lookup performance by reading the entire file into memory on initialization. Maps ranges of MAC addresses to manufacturers and comments (descriptions). Contains full support for netmasks and other strange things in the database.
See https://www.wireshark.org/tools/oui-lookup.html
- Args:
- manuf_name (str): Location of the manuf database file. Defaults to “manuf” in the same directory. update (bool): Whether to update the manuf file automatically. Defaults to False.
- Raises:
- IOError: If manuf file could not be found.
-
MANUF_URL
= 'https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob_plain;f=manuf'¶
-
get_all
(mac)¶ Get a Vendor tuple containing (manuf, comment) from a MAC address.
- Args:
- mac (str): MAC address in standard format.
- Returns:
- Vendor: Vendor namedtuple containing (manuf, comment). Either or both may be None if not found.
- Raises:
- ValueError: If the MAC could not be parsed.
-
get_comment
(mac)¶ Returns comment from a MAC address.
- Args:
- mac (str): MAC address in standard format.
- Returns:
- string: String containing comment, or None if not found.
- Raises:
- ValueError: If the MAC could not be parsed.
-
get_manuf
(mac)¶ Returns manufacturer from a MAC address.
- Args:
- mac (str): MAC address in standard format.
- Returns:
- string: String containing manufacturer, or None if not found.
- Raises:
- ValueError: If the MAC could not be parsed.
-
refresh
(manuf_name=None)¶ Refresh/reload manuf database. Call this when manuf file is updated.
- Args:
- manuf_name (str): Location of the manuf data base file. Defaults to “manuf” in the
- same directory.
- Raises:
- IOError: If manuf file could not be found.
-
search
(mac, maximum=1)¶ Search for multiple Vendor tuples possibly matching a MAC address.
- Args:
- mac (str): MAC address in standard format. maximum (int): Maximum results to return. Defaults to 1.
- Returns:
- List of Vendor namedtuples containing (manuf, comment), with closest result first. May be empty if no results found.
- Raises:
- ValueError: If the MAC could not be parsed.
-
update
(manuf_url=None, manuf_name=None, refresh=True)¶ Update the Wireshark OUI database to the latest version.
- Args:
- manuf_url (str): URL pointing to OUI database. Defaults to database located at
- code.wireshark.org.
- manuf_name (str): Location to store the new OUI database. Defaults to “manuf” in the
- same directory.
- refresh (bool): Refresh the database once updated. Defaults to True. Uses database
- stored at manuf_name.
- Raises:
- URLError: If the download fails
-
class
securecrt_tools.manuf.
Vendor
(manuf, comment)¶ Bases:
tuple
-
comment
¶ Alias for field number 1
-
manuf
¶ Alias for field number 0
-
-
securecrt_tools.manuf.
main
()¶ Simple command line wrapping for MacParser.


Variables come in a few varieties in Ruby:
variable_name
- local variable - Written in lower case, local variables are local to wherever they appear in code. They are not accessible across methods, and are sometimes even smaller in scope than that - accessible only inside of a block or a loop, for instance. @variable_name
- instance variable - Written with a leading '@' symbol, instance variables are local to an instance of a class. Other instances of the same class do not have access, but all methods within the local instance may access them.@@variable_name
- class variable - Written with two leading '@' symbols, class variables are local to an entire class. Every instance of the class may access them, but not objects outside that class.$variable_name
- global variable - Writte with a leading '$' symbol, global variables are accessible anywhere in the code in which they appear, regardless of what class or method they are declared in. VARIABLE_NAME
- constant - Constants' scope depends on where they are declared - usually they are declared in 'main,' which, in most cases means they act like global variables, but there are exceptions to this. They are meant to remain unchanged, although, like variables, Ruby will let you change their value, but it will throw a warning when you do. Constants begin with a capital letter, although it is common syntax to spell them with all caps.


Launch Program. Use the Open command from the File menu or ⌘O to select files to modify. You can also drag files from the finder into the table on the left side of the application window. File names shown in a light grey color are not recognized as valid image files. Such files can not be modified. Dragging or opening a folder will add all the files in the folder and any subfolders.
GPS track logs in the form of GPX files can also be opened or dragged onto the table on the left side of the window. Tracks are displayed in Red on the map. The color can be changed in program Preferences.
Select one or more images. When selecting multiple images the last image selected is displayed in the image well (upper right portion of the window). Its location (if any) is marked on the map. When multiple rows are selected the latitude and longitude of the image displayed in the image well and marked on the map location will be shown in yellow.
Click on the map to set or change the location of all selected images. Existing location can also be changed by clicking elsewhere on the map. Hitting the delete key will remove location information from all selected images. You can Undo/Redo image location changes.
Double click on a the date/time in row in the table to change the date/time of the image. A window will open containing the current date/time and a date/time selector to choose a new date/time. Hitting return or clicking on the Change button will note the changed time. The image file will not be updated until changes are saved. Note: date/time changes are not currently in the undo/redo tree.
Select multiple images and then hit ⌘L, or Edit -> Modify Date/Time, or right-click -> Modify Date/Time to open the change time window for the most selected image. If the time is changed a delta between the original date/time and the updated date/time is calculated. That delta is then applied to all of the selected images.
In a similar manner the location assigned to an image can be entered from the keyboard. Double click on either the latitude or longitude in a row in the table to edit the location for that row. Coordinated can be entered as degrees, degrees and minutes, or degrees, minutes and seconds. A lat/lon reference can be specified or you can use a negative number of degrees for South latitudes and West longitudes.
Select multiple images and then hit Shift-⌘L, or Edit -> Modify Location, or right-click -> Modify Location to open the change location window for the most selected image. The location of all selected images will be set to the entered value.
Edit -> Locn from track or ⌘L will update the location of selected images from the track log. This is done by matching timestamps. The track log location with a time stamp less than or equal to the image time stamp is used as the image location. The location can them be tweaked by moving the marker. If the image does not have a timestamp or of the timestamp is before all of the points in the track log no location will be assigned. WARNING: if the track logs are from a time before the images were taken the locations will be set to the last point in the track log.
You may double click on the map to zoom or you can use the zoom controls. A pinch gesture works on trackpads. Panning works as expeted. There is also a search bar. Enter an address or partial address to center the map on the desired location. Zoom in/out as needed.
GeoTag can interpolate positions for images between two images with assigned locations. This might be useful where you know starting and ending locations and would like to approximate where on the straight path between the two other images may have been taken. To use this feature:
Three map types --- Standard, Hybrid, and Satellite --- are supported. You can also use street view, but... the latitude and longitude of a map marker in street view do not match the same marker on one of the other three map views.
If you find yourself working in a specific area of a map you can save the map type, location, and zoom level by clicking on the Save Map Layout button. When GeoTag is launched the map will load to the last saved location, style, and zoom level.
You may cut or copy location information from a single image and then paste that information into one or more images. If you make an error you can undo/redo your changes. You can undo all changes to all images by selecting "Discard changes" from the "File" menu. All Undo/Redo information is cleared once changes are discarded or saved.
The original versions of images that have been changed and saved are in your backup folder. A "backup folder" location is required. If a backup folder is not configured when GeoTag starts the program will open the preferences window for you to select a location.
When saving geo location data to an image a copy of the un-edited image is placed in the backup folder. If an image of the same name exists in that folder a numbered suffix will be added to the name. The name with the highest numbered suffix is the most current backup (usually).
If the image file can not be copied to the backup location Geolocation information will not be saved. Better to be safe than sorry.
If there are no changes pending the list of images can be cleared using File -> Clear image list, ⌘K.A preference item exists to update GPS Date/Time stamps in the image metadata whenever a location is modified.
Cut, Copy, Paste, Delete, Interpolate, Locn from track, and Clear Image List can be accessed from a pop up menu by right or control clicking on an entry in the list.
Please report any issues to <marc@snafu.org>.


| PERLDBMFILTER(1) | Perl Programmers Reference Guide | PERLDBMFILTER(1) |
$db = tie %hash, 'DBM', ... $old_filter = $db->filter_store_key ( sub { ... } ); $old_filter = $db->filter_store_value( sub { ... } ); $old_filter = $db->filter_fetch_key ( sub { ... } ); $old_filter = $db->filter_fetch_value( sub { ... } );
Each of the methods works identically, and is used to install (or uninstall) a single DBM Filter. The only difference between them is the place that the filter is installed.
To summarise:
You can use any combination of the methods from none to all four.
All filter methods return the existing filter, if present, or "undef" if not.
To delete a filter pass "undef" to it.
For example, consider the following scenario. You have a DBM database that you need to share with a third-party C application. The C application assumes that all keys and values are NULL terminated. Unfortunately when Perl writes to DBM databases it doesn't use NULL termination, so your Perl application will have to manage NULL termination itself. When you write to the database you will have to use something like this:
$hash{"$key\0"} = "$value\0";
Similarly the NULL needs to be taken into account when you are considering the length of existing keys/values.
It would be much better if you could ignore the NULL terminations issue in the main application code and have a mechanism that automatically added the terminating NULL to all keys and values whenever you write to the database and have them removed when you read from the database. As I'm sure you have already guessed, this is a problem that DBM Filters can fix very easily.
use strict; use warnings; use SDBM_File; use Fcntl; my %hash; my $filename = "filt"; unlink $filename; my $db = tie(%hash, 'SDBM_File', $filename, O_RDWR|O_CREAT, 0640) or die "Cannot open $filename: $!\n"; # Install DBM Filters $db->filter_fetch_key ( sub { s/\0$// } ); $db->filter_store_key ( sub { $_ .= "\0" } ); $db->filter_fetch_value( sub { no warnings 'uninitialized'; s/\0$// } ); $db->filter_store_value( sub { $_ .= "\0" } ); $hash{"abc"} = "def"; my $a = $hash{"ABC"}; # ... undef $db; untie %hash;
The code above uses SDBM_File, but it will work with any of the DBM modules.
Hopefully the contents of each of the filters should be self-explanatory. Both "fetch" filters remove the terminating NULL, and both "store" filters add a terminating NULL.
$hash{12345} = "something";
the key 12345 will get stored in the DBM database as the 5 byte string "12345". If you actually want the key to be stored in the DBM database as a C int, you will have to use "pack" when writing, and "unpack" when reading.
Here is a DBM Filter that does it:
use strict; use warnings; use DB_File; my %hash; my $filename = "filt"; unlink $filename; my $db = tie %hash, 'DB_File', $filename, O_CREAT|O_RDWR, 0666, $DB_HASH or die "Cannot open $filename: $!\n"; $db->filter_fetch_key ( sub { $_ = unpack("i", $_) } ); $db->filter_store_key ( sub { $_ = pack ("i", $_) } ); $hash{123} = "def"; # ... undef $db; untie %hash;
The code above uses DB_File, but again it will work with any of the DBM modules.
This time only two filters have been used; we only need to manipulate the contents of the key, so it wasn't necessary to install any value filters.
| 2019-10-21 | perl v5.30.3 |


{% extends 'layout.html' %} {% block pageTitle %} Updating the kit - NHS.UK prototype kit {% endblock %} {% block beforeContent %} {% include "how-tos/includes/breadcrumb.html" %} {% endblock %} {% block content %}
If you have made any changes outside the app folder, this process will destroy those changes. We will try and improve the update process to avoid this, but in the meantime you will need to make a note of your changes outside app, and add them back after updating.
If you've made any changes to the config.js file in your prototype then you'll need to re-enter them in the new version of the file e.g. the service name.
npm install
.WARN
about some items - this is ok. As long as there are no ERRORs
you can continue.
npm run watch
.If you have any problems, ask a developer on your team (if you have one), email us or get in touch on the NHS digital service manual #prototype-kit Slack channel.
{% include "how-tos/includes/back-button.html" %}


Most work on the marker selections
| Key | Action |
|---|---|
| space | stop and start playback |
| a | create path over the duration of the clip |
| b | creates brush strokes along the ground |
| c | creates a curve between the selected markers |
| g | toggles the grid visibility |
| k | show this dialog |
| m | toggles the marker visibility |
| o | open load dialog |
| s | hide/show marker selection |
| t | create trails from selected points |
| u | create "up" arrows |
| v | create "look-ahead" velocity vector arrows |
| x | step one frame forward in time |
| z | step one frame back in time |
| ` | remove all lines |


---
layout: index-layout
subject: My Email Templates
---
Hi there!
Josh here from Code Corps. I just wanted to say hi since you signed up for Code Corps recently.
Would you mind replying to me with a sentence or two of feedback on what you think? Your thoughts would be a huge help.
And please consider joining our Slack room http://slack.codecorps.org to come chat with people in the community.
Thanks!
Josh Smith