DIFF3
Section: User Commands (1)Updated: April 2002
Index Return to Main Contents
NAME
diff3 - compare three files line by lineSYNOPSIS
diff3 [OPTION]... MYFILE OLDFILE YOURFILEDESCRIPTION
Compare three files line by line.- -e --ed
- Output unmerged changes from OLDFILE to YOURFILE into MYFILE.
- -E --show-overlap
- Output unmerged changes, bracketing conflicts.
- -A --show-all
- Output all changes, bracketing conflicts.
- -x --overlap-only
- Output overlapping changes.
- -X
- Output overlapping changes, bracketing them.
- -3 --easy-only
- Output unmerged nonoverlapping changes.
- -m --merge
- Output merged file instead of ed script (default -A).
- -L LABEL --label=LABEL
- Use LABEL instead of file name.
- -i
- Append `w' and `q' commands to ed scripts.
- -a --text
- Treat all files as text.
- -T --initial-tab
- Make tabs line up by prepending a tab.
- --diff-program=PROGRAM
- Use PROGRAM to compare files.
- -v --version
- Output version info.
- --help
- Output this help.
If a FILE is `-', read standard input.
AUTHOR
Written by Randy Smith.REPORTING BUGS
Report bugs to<EMAIL_ADDRESS>Copyright © 2002 Free Software Foundation, Inc.This program comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of this program under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING.
SEE ALSO
The full documentation for diff3 is maintained as a Texinfo manual. If the info and diff3 programs are properly installed at your site, the command- info diff
should give you access to the complete manual.
Index
This document was created by man2html, using the manual pages.
Time: 05:29:03 GMT, December 24, 2015


[gecode-users] Constraints in Gecode for unconstrained instances.
Bouchene Sabrina
genius_linda1987 at yahoo.fr
Thu Oct 30 10:46:25 CET 2014
Hi,
I want to write a program in Gecode for tow types of instances: the constrained instances (where all constraints must be satisfied) and the unconstrained instances (where one constraint or more can be not satisfied if the solution is optimal).
The question is how th do for the second type of constraint. ie, not necessarly all constraints be satisfied. ( ie, if exists an operator like "OR" to write between constraints or how to do ?).
Thank you in advance.Best regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20141030/318adfec/attachment.html>
More information about the users
mailing list


This illustrates the fact that $\mathbb{R}P^1$ is homeomorphic to
$S^1$. Recall that $\mathbb{R}P^1=S^1/E$, where $uEv$ iff
$v=\pm u$. A point of $\mathbb{R}P^1$ is an equivalence class for
this relation, or in other words a pair of opposite points in
$S^1$, as shown on the outer circle. Given such a pair $p$,
we draw a line between them and let $f(p)$ be the point where
that line meets the inner circle. This defines a map
$f\colon\mathbb{R}P^1\to S^1$, which can be shown to be a
homeomorphism. Strictly speaking, the codomain here is the
circle of radius $1/2$ centred at $1/2\in\mathbb{C}$. To
get a map to the standard unit circle $S^1$, we should
consider $g(p)=2\,f(p)-1$. A little coordinate geometry and
algebra gives the formula $g([z])=z^2$, so this is the same
map as we have considered previously.


Salary Calculator LIVE SOLVE
First Name:
Last Name:
Employee ID:
Title:
Salary:
Submit
First Name
Last Name
ID
Title
Salary
Delete


10:00
{{username}}
Password:
Security Code:
Enter Key to Launch UPLOAD:
secret message
Brave New World
Little Women
Heart of Darkness
Invisible Man
The Scarlet Letter
Fahrenheit 451
Lord of the Flies
who's the most powerful company in the world right now?
SAFE BOX
Password:


#^------------------------------ #^title trim=ends {_blog_post_json.title} #^------------------------------ #^_blog_post_json { "title":"Bards Log 12", "author":"Strumm", } #^------------------------------ #^_blog_post_body form=markdown With Benito kidnapped for interrogation purposes, Gwinny had free reign to disguise herself as the beloved italian chef to look around Lord Pendeghast's mansion.
From here, we were able to suss out the hypnotic effect the pink gems had on Maelion. The effect quickly dissipated as soon as Gwinny reached out to slice his throat. It all seemed far too easy. Still, her covert operation remained intact as they swiftly exchanged words about some rotten trout and meat served at yesterday's lunch. Desperate to stop the ultimate Channel Divinity gig that was looming in the horizon, Gwinny left the manor short of clues but arms filled with muttering masks and a magnificent golden drum set. During which Leon was busy harassing the real Benito in the dark alley way to no avail, Dave was setting up a protest showing with me helping out. Down with that sort of thing and all that. Later we reconvened at Aeropose's and requested he set us up a bomb. The Hyperfast Mining Thing was suggested, mostly as he doesn't like it underneath his shop. The plan was for me to use my boots of choir to fly over the stage and use Mage Hand to place and detonate the Hyperfast Mining Thing whilst we were all very much out of sight. The only condition Aeropose had was that no one was to get hurt. Easier said that done but we agreed. Pretty soon, a small mushroom cloud appeared over what used to be the stage for Channel Divinity's ultimate gig and 3 unlucky occultists were blamed for the deed when they were caught suspecting each other under hushed tones at the local pub. To rejoice, we initiated an impromptu gig with our biggest fan who showed up for the protest. Leon worked the crowd like the fabulous manager we know and love, everyone was chanting, "Bards! Bards! Bards!" as we belted our latest and greatest to the tune of Channel Divinity shaking their fists from Lord Pendeghast's house. There was also the perform-off with Abrigand which lasted about an hour. Just an infinite solo loop alternating between him and Gwinny. Abrigand won with one note over but it was pretty clear Bards! Bards! Bards! was the true winner.


Dynamic Programming?
问题描述 :
Dynamic Programming, short for DP, is the favorite of iSea. It is a method for solving complex problems by breaking them down into simpler sub-problems. It is applicable to problems exhibiting the properties of overlapping sub-problems which are only slightly smaller and optimal substructure.
Ok, here is the problem. Given an array with N integers, find a continuous subsequence whose sum’s absolute value is the smallest. Very typical DP problem, right?
Ok, here is the problem. Given an array with N integers, find a continuous subsequence whose sum’s absolute value is the smallest. Very typical DP problem, right?
输入:
The first line contains a single integer T, indicating the number of test cases.
Each test case includes an integer N. Then a line with N integers Ai follows.
Each test case includes an integer N. Then a line with N integers Ai follows.
Technical Specification
1. 1 <= T <= 100
2. 1 <= N <= 1 000
3. -100 000 <= Ai <= 100 000
输出:
The first line contains a single integer T, indicating the number of test cases.
Each test case includes an integer N. Then a line with N integers Ai follows.
Each test case includes an integer N. Then a line with N integers Ai follows.
Technical Specification
1. 1 <= T <= 100
2. 1 <= N <= 1 000
3. -100 000 <= Ai <= 100 000
样例输入:
2 2 1 -1 4 1 2 1 -2
样例输出:
Case 1: 0 Case 2: 1
题意：
给你一n个数，有正有负，求连续的的最小绝对值
因为数据1000*1000完全可以暴力
dp[i]=min(dp[i],abs(sum(A[j],A[i])))
后者：j到i的数字和的绝对值
#include"stdio.h" #include"string.h" #define N 1101 int abs(int a) { if(a>0)return a; return -a; } int main() { int T; int n; int A[N]; int dp[N]; int i,j,t; int ans,cnt; scanf("%d",&T); cnt=1; while(T--) { scanf("%d",&n); scanf("%d",&A[0]); ans=dp[0]=abs(A[0]); for(i=1;i<n;i++) { scanf("%d",&A[i]); dp[i]=abs(A[i]); t=A[i]; //因为要求是连续的，所以得从i-1开始 for(j=i-1;j>=0;j--) { t+=A[j]; if(abs(t)<dp[i]) dp[i]=abs(t); } if(dp[i]<ans)ans=dp[i]; } printf("Case %d: %d\n",cnt++,ans); } return 0; }
版权声明：本文为博主原创文章，未经博主允许不得转载。
参考：http://blog.csdn.net/yangyafeiac/article/details/9613505
(adsbygoogle = window.adsbygoogle || []).push({});
起来嗨啊嗨起来
起来嗨啊嗨起来
起来嗨啊嗨起来
起来嗨啊嗨起来
起来嗨啊嗨起来
起来嗨啊嗨起来
起来嗨啊嗨起来
起来嗨啊嗨起来


A singly linked list is a data structure consisting of a group of nodes linked together linearly. Each node consists of data elements and a link to the next node. The main advantage of linked lists over simple arrays is that the nodes can be inserted anywhere in the list without reallocating the entire array because the nodes in a linked list do not need to be stored contiguously in memory. However, nodes in the list cannot be accessed by index but must be accessed by traversing the list.
Creating and Initializing Lists
To create and initialize a linked list, create
a le_sls_List_t typed list and assign LE_SLS_LIST_INIT to it. The assignment of LE_SLS_LIST_INIT can be done either when the list is declared or after it's declared. The list must be initialized before it can be used.
Or
The elements of le_sls_List_t MUST NOT be accessed directly by the user.
Creating and Accessing Nodes
Nodes can contain any data in any format and is defined and created by the user. The only requirement for nodes is that it must contain a le_sls_Link_t link member. The link member must be initialized by assigning LE_SLS_LINK_INIT to it before it can be used. Nodes can then be added to the list by passing their links to the add functions (le_sls_Stack(), le_sls_Queue(), etc.). For example:
The links in the nodes are added to the list and not the nodes themselves. This allows a node to be simultaneously part of multiple lists simply by having multiple links and adding the links into differently lists. This also means that nodes in a list can be of different types.
Because the links and not the nodes are in the list, the user must have a way to obtain the node itself from the link. This is achieved using the CONTAINER_OF
macro defined in le_basics.h. This code sample shows using CONTAINER_OF to obtain the node:
The user is responsible for creating and freeing memory for all nodes, the linked list module simply manages the links in the nodes. The node must first be removed from all lists before its memory is freed.
The elements of le_sls_Link_t MUST NOT be accessed directly by the user.
Adding Links to a List
To add nodes to a list pass the node's link to one of the following functions:
- le_sls_Stack() - Adds the link to the head of the list.
- le_sls_Queue() - Adds the link to the tail of the list.
- le_sls_AddAfter() - Adds the link to a list after another specified link.
Removing Links from a List
To remove nodes from a list, use le_sls_Pop()
to remove and return the link at the head of the list.
Accessing Links in a List
To access a link in a list without removing the link, use one of the following functions:
le_sls_Peek()
- Returns the link at the head of the list without removing it.le_sls_PeekNext()
- Returns the link next to a specified link without removing it.
Querying List Status
The following functions can be used to query a list's current status:
- le_sls_IsEmpty() - Checks if a given list is empty or not.
- le_sls_IsInList() - Checks if a specified link is in the list.
- le_sls_NumLinks() - Checks the number of links currently in the list.
- le_sls_IsListCorrupted() - Checks if the list is corrupted.
Queues and Stacks
This implementation of linked lists can easily be used as either queues or stacks.
To use the list as a queue, restrict additions to the list to le_sls_Queue()
and removals from the list to le_sls_Pop()
.
To use the list as a stack, restrict additions to the list to le_sls_Stack()
and removals from the list to le_sls_Pop()
.
Thread Safety and Re-Entrancy
All linked list function calls are re-entrant and thread safe. But if the nodes and/or list object is shared by multiple threads, then explicit steps must be taken to maintain mutual exclusion of access.
Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.


[:page partOf="hello_security"]
Sign in
Usernames for testing: john (a normal user) and admin (an administrator). The password is 123.


Complex and Vector Variables
Summary: Generalizations of differentiation and integration to spaces of higher dimension: divergence, curl, and the classical integration theorems of multivariable calculus. Introduction to analytic functions of a complex variable, including Laurent series, Cauchy's formula, and conformal mapping


WOO-VIES
A Desktop Application for Recommending Movies/TV shows
Create account for Woo-vies
New Username
New Password
Do you already have account?
Click here to Log in
.


Class Level
Abstracted version of ldtk's level
Inheritance
Inherited Members
Namespace: LDtk
Assembly: LDtkMonogame.dll
Syntax
public class Level
Properties
| Improve this Doc View SourceBgColor
The clear color for the level
Declaration
public Color BgColor { get; }
Property Value
| Type | Description |
|---|---|
| Microsoft.Xna.Framework.Color |
Identifier
The identifier of the level set in ldtk
Declaration
public string Identifier { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Layers
Prerendered layer textures created from GetLevel(String)
Declaration
public RenderTarget2D[] Layers { get; }
Property Value
| Type | Description |
|---|---|
| Microsoft.Xna.Framework.Graphics.RenderTarget2D[] |
Neighbours
The neighbours uids of the level
Declaration
public long[] Neighbours { get; }
Property Value
| Type | Description |
|---|---|
| System.Int64[] |
Position
World position of the level
Declaration
public Vector2 Position { get; }
Property Value
| Type | Description |
|---|---|
| Microsoft.Xna.Framework.Vector2 |
Size
World size in pixels of the level
Declaration
public Vector2 Size { get; }
Property Value
| Type | Description |
|---|---|
| Microsoft.Xna.Framework.Vector2 |
Uid
The Uid of the level set in ldtk
Declaration
public long Uid { get; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
Methods
| Improve this Doc View SourceGetEntities(String)
Gets the parsed entities from the ldtk json If fields are missing they will be logged to the console in debug mode only
Declaration
public Entity[] GetEntities(string identifier)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | identifier | The name of the entity to parse this to |
Returns
| Type | Description |
|---|---|
| Entity[] | The entities cast to the class |
GetEntities<T>()
Gets the parsed entities from the ldtk json If fields are missing they will be logged to the console in debug mode only
Declaration
public T[] GetEntities<T>()
where T : Entity, new()
Returns
| Type | Description |
|---|---|
| T[] | The entities cast to the class |
Type Parameters
| Name | Description |
|---|---|
| T | The class/struct you will use to parse the ldtk entities |
GetEntities<T>(String)
Gets the parsed entities from the ldtk json If fields are missing they will be logged to the console in debug mode only
Declaration
public T[] GetEntities<T>(string identifier)
where T : Entity, new()
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | identifier | The name of the entity to parse this to |
Returns
| Type | Description |
|---|---|
| T[] | The entities cast to the class |
Type Parameters
| Name | Description |
|---|---|
| T | The class/struct you will use to parse the ldtk entities |
GetEntity(String)
Gets the parsed entity from the ldtk json If fields are missing they will be logged to the console in debug mode only
Declaration
public Entity GetEntity(string identifier)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | identifier | The name of the entity to parse this to |
Returns
| Type | Description |
|---|---|
| Entity | The entity cast to the Entity class |
GetEntity<T>()
Gets the first found parsed entity from the ldtk json If fields are missing they will be logged to the console in debug mode only
Declaration
public T GetEntity<T>()
where T : Entity, new()
Returns
| Type | Description |
|---|---|
| T | The entity cast to the class |
Type Parameters
| Name | Description |
|---|---|
| T | The class/struct you will use to parse the ldtk entity |
GetEntity<T>(String)
Gets the first found parsed entity from the ldtk json If fields are missing they will be logged to the console in debug mode only
Declaration
public T GetEntity<T>(string identifier)
where T : Entity, new()
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | identifier | The name of the entity to parse this to |
Returns
| Type | Description |
|---|---|
| T | The entity cast to the class |
Type Parameters
| Name | Description |
|---|---|
| T | The class/struct you will use to parse the ldtk entity |
GetIntGrid(String)
Gets an IntGrid from an identifier
Declaration
public IntGrid GetIntGrid(string identifier)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | identifier | Identifier of an intgrid |
Returns
| Type | Description |
|---|---|
| IntGrid |


Climate
The Climate in Bolivia is beautiful. It is warm all year round in most of the departments.
It is said to be the country of eternal spring. Its always a little chilly in the morning and night but nice and hot during the day.
Safety
Bolivia is a very safe place to visit. people are very friendly and are willing to help out when you have questions about where to go. Although Bolivia is a safe country, like any other country there is always some caution to have when traveling. pickpocketting and political protesting is very common so always pay attention to your belongings and never travel alone.


Graphics and Branding
Mateelda
branding package for local fashion design company MATEELDA.
incorporating classic, elegant and feminine themes.
vector created from company owner's sketch.
Stuffies
marketing and uniform design package for Stuffies Pastries Cafe.
incorporating charming, clean designs.


@* * Copyright 2023 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @import controllers.auth.requests.UserRequest @import viewmodels.{AddressRowModel, ExtraLinks, PersonalDetailsTableRowModel} @import scala.concurrent.ExecutionContext @import components.{H1, H2, P} @this( main: MainView, h1: H1, h2: H2, p: P, hmrcPageHeading: HmrcPageHeading ) @( personalDetails: Seq[PersonalDetailsTableRowModel], addressDetails: AddressRowModel, trustedHelpers: Option[PersonalDetailsTableRowModel], paperlessHelpers: Option[PersonalDetailsTableRowModel], signinDetailsHelpers: Option[PersonalDetailsTableRowModel], manageTaxAgent: Option[PersonalDetailsTableRowModel] )(implicit request: UserRequest[_], messages: play.api.i18n.Messages) @rowsPresenter(row: PersonalDetailsTableRowModel, extraLinks: List[ExtraLinks] = Nil) = {
${messages(row.linkTextMessage)}
""") ) @extraLinks.map { url => @messages(url.linkTextMessage) @if(row.visuallyhiddenText.nonEmpty) { @messages(row.visuallyhiddenText) } }


In this project, we're going to make a knock-knock joke generator!
1. Give your page a title.
2. Create a button that says "Click here for a joke!". Make sure to give your button an id
.
3. Create two more buttons -- "Who's there?", and "...who?" -- give them id
's.
4. Use CSS to make the "Who's there?" and "...who?" buttons hidden.
5. Above the buttons, create an empty span
. Give it an id
.
6. When the "Click here for a joke!" button is clicked, make the button hide...
7. ...and make the empty span
say "Knock knock"...
8. ...and make the "Who's there?" button appear.
9. Think up your best Knock Knock jokes (or find some on the internet). Then, create one array that holds the response to "Who's There?" and one array that holds the punchlines.
(Hint: The name and the punchline that go together should have the same index location in the two different arrays)
10. Write a function that randomly selects a joke from your joke arrays.
11. When the "Who's there?" button is clicked, run your function to choose a joke...
12. ...and, in the empty span
, replace "Knock knock" with the first part of the chosen joke...
13. ...and make the "...who?" button appear, but replace the text in that button with the word from the joke.
(for example: "Orange who?" or "Boo who?")
14. When you click the "...who?" button, make that button disappear...
15. ...and make the punchline of the joke replace the text in the empty span
...
16. ...and have the "Click here for a joke!" button reappear.
17. Make sure everything works right when you click the button again.
(don't forget to clear the empty span
!)
18. Keep working on your project until you're happy with it. You can make it look cool, add different features, think up more jokes, etc.
19. Save and share your project!


5 makeup trends by celebrities to inspire your next look
by Sarah PriceKARACHI: With the shaadi season rapidly dawning upon us once more, there’s no better time to experiment with your makeup routine and try out some looks that is sure to turn heads.
 Thinking of a glitzy look for New Year celebrations? Look no further than to fashion it-girl Gigi Hadid who is shining brighter than a star.
Dark lips colours are also making their way back to the trending beauty cut. For a seriously sultry look, we see Sabeeka Imam hitting all the right notes. Yumna Zaidi also shows us how to work red lipstick right.
Here are some of our top picks by celebrities.
Smudged wing liner
This smudged wing liner trend is popping up everywhere, with top beauty vloggers and Instagrammers showing us how the captivating look is achieved. Model Zara Peerzada certainly knows how to accentuate her eyes in all the right ways.  Smudge slightly and line the inner bottom of your eyes. Pair with matte, warm nude lipstick.
Matte red lipstick
Red lipstick is back baby and we are not complaining! For a truly soft and dreamy look, we love actor Yumna Zaidi’s take on the trend. Use a matching matte lip liner to lightly shape lips, then go in with a red shade by applying with fingers. Blot the sharpness of the red by putting mouth on a tissue.  Keep eyes minimal with a flick of mascara.
Classic red lips and cat eyes
Oh-la-la, mademoiselle. Get those classic french vibes with Pakistani–British model Sabeeka Imam by doing a cat eye and deep red lipstick for your next event. Keep eye shadow to a matte light brown or taupe and carefully make a sharp flick with waterproof liquid liner. Choose a deep red classic red lipstick to complete the look.3 hairstyle trends by Hollywood celebs to inspire your next look
Beauty hack: Scared of not doing the flick right? Get some sticky tape and angle on both eyes to make a perfectly symmetrical line before going in with liner.
Champagne evening glam
Looking for all those right nude shades without seeming washed out? Sadaf Kanwal aces this makeup trend by selecting a warm, champagne nude lipstick to suit her skin tone. Use bronzer to warm and contour your face. Use a shimmery, champagne eye shadow and use finger to smudge on eyelids, as well as pencil liner. Slightly line watermark and blend.
Half-glitter eyeshadow
Yep, Gigi Hadid does it again. The American-Palestinian model serves major inspiration for a New Year’s event by donning this gold eyeshadow look that makes her shine brighter than a star. Rather than use a loose gold glitter all over the eyes, first use a neutral matte shadow over all the eyes and then use a brush to dust the glitter over half the lid. This gives a glam look without going overboard, keeping it classy. Pair with a cat-eye flick and and a war, shiny nude lip.


Installing and configuring Apache
Installing apache
- Install apache and php using apt-get
sudo apt-get install apache2 php5 libapache2-mod-php5
- You should now have a directory
/var/www
- Surf to your domain name or ip address and check if the site is online
Need to knows
- You can restart apache using the following command if ever needed
sudo service apache2 restart
- The PHP config file can be found as
/etc/php5/apache2/php.ini
- Main apache config, sites-available and sites-enabled can be found in
/etc/apache2/
Configure Apache Rewrite
- Make sure that apacha is allowing .htaccess files to override permissions by changing the line
'AllowOverride None'
to 'AllowOverride All'
sudo nano /etc/apache2/sites-available/default
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
- Restart the apache service
sudo service apache2 restart
Adding system accounts to the www-data group
- This allows the users to cd into the
/var/www
dirs
- Add
nico
to the www-data
group
sudo usermod -a -G www-data nico
- Display the groups a user is assigned to using
id nico
- Display all available groups using
cat /etc/group
Setting up MySql
sudo apt-get install mysql-server mysql-client php5-mysql
- Enter a root password when requested
Setting up PhpMyAdmin
- Install PhpMyAdmin using apt-get
sudo apt-get install phpmyadmin
- Select apache2 when asked
- The first password that needs to be provided is the root password of the database.
- The second password is the password that is attached to the phpmyadmin user account.
- Select to configure database. If you miss you can restart config using
sudo dpkg-reconfigure phpmyadmin
- You should now be able to access phpmyadmin via
http://<server-ip-address/phpmyadmin
Website deployment using GIT
Creating a deployment directory
- Start by creating a new directory in
/var/www
cd /var/www
sudo mkdir mynewsite
sudo chown git:www-data mynewsite
sudo chmod 750 mynewsite
Creating a deployment hook
- Start by logging in with the user git
sudo su git
cd ~/repositories/myfirstgitrepo.git
- Copy the sample
post-update.sample
hook
- Make sure to name the new file post-update
cd hooks
cp post-update.sample post-update
Creating a deployment hook
- Edit the post-update hook using nano
- Do a checkout action of the git repository to your deployment directory
#!/bin/sh
echo "... Deploying your web application ..."
# Hook specific code
umask 0027 && GIT_WORK_TREE=/var/www/mynewsite git checkout -f
echo "... Done deploying ..."
Linux umask
- When a user creates a file or directory under Linux, it is created with a default set of permissions
- The user file-creation mode mask (umask) is used to determine the file permission for newly created files
- Default files are created with the access mode 666 and directories with 777
- The default umask 002 used for normal user
- The default umask for the root user is 022
Linux umask
| |
Normal User |
Root |
| File |
666
-002
664 = rw-rw-r--
|
666
-022
644 = rw-r--r--
|
| Directory |
777
-002
775 = rwxrwxr-x
|
777
-022
755 = rwxr-xr-x
|
Looking back at our hook
umask 0027 && GIT_WORK_TREE=/var/www/mynewsite git checkout -f
- This is executed in context of the GIT user
- So for files: 666 - 027 = 640 = rw-r-----
- And for dirs: 777 - 027 = 750 = rwxr-x---
- So the
git
user has all rights and the git
group has only read rights. Nobody else can view the files or traverse the dirs.
Let's test it
- Add and commit an
index.html
file in the git repository
- Push the repository
git add index.html
git commit -m "Added index file"
git push origin master
Let's test it
- Ow but wait, what about the
www-data
user ? How can the webserver access these files ?
Allow apache to access the deployed site
- We could add the
www-data
user to the git
group but this is a security risk
- We could do a
chown
inside the hook code but git does not have the rights and this would break existing sites and permissions
- Solution: set the s-bit on the initial drop directory for the group
- This makes sure that the group is set to
www-data
of all new files and dirs
Allow apache to access the deployed site
- Remove all the content inside the drop directory
cd /var/www/mynewsite/
rm index.html
- Set the s-bit of the drop dir
cd ..
sudo chmod g+s mynewsite
ls -al
Let's test it
- Add and commit a change to the
index.html
file
- Push the repository
git add index.html
git commit -m "Added index file"
git push origin master
Check the permissions
- Check the permissions of the files on the server
cd /var/www/mynewsite
ls -al


We are a local, specialist flat roofing company, but we also do a lot more!
Whether it's building works, roof repairs, box-gutters, roof lanterns, or cladding, we pride ourselves in providing the best solutions for your needs.
Due to our very high standards, we have continued satisfaction from all our customers making us a company you can trust.