This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # use this script to initialize work on gentoo install | |
| # this is the base for fully installing automatically | |
| # we still have lot's of work to do ... | |
| # mount everything needed for a working chroot | |
| function mount_all(){ | |
| mount $1 /mnt/gentoo | |
| mount -t proc proc /mnt/gentoo/proc | |
| mount --rbind /sys /mnt/gentoo/sys | |
| mount --make-rslave /mnt/gentoo/sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vagrant@saltmaster:/srv/salt$ vim common/py_packages.sls # edit and mark django for downgrade | |
| vagrant@saltmaster:/srv/salt$ sudo salt minion1 state.sls common.py_packages | |
| minion1: | |
| ---------- | |
| ID: install_django == 1.8.0 | |
| Function: pip.installed | |
| Name: django == 1.8.0 | |
| Result: True | |
| Comment: All packages were successfully installed | |
| Started: 08:58:20.748303 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% if grains['os'] == 'CentOS' %} | |
| {% set piploc = '/usr/bin/pip' %} | |
| {% elif grains['os'] == 'Ubuntu' %} | |
| {% set piploc = '/usr/local/bin/pip' %} | |
| {% endif %} | |
| {% if not salt['file.file_exists'] == piploc %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #SHELL = bash -xv | |
| .PHONY: create_all_tasks, quick, slow, task_one, task_two show_tree, sleep | |
| slow: | |
| $(shell echo "this task will hang around;15" > 4.task) | |
| quick: | |
| $(shell echo "this task will finish quickly;5" > 3.task) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| CONFIG_FILE=$1 | |
| source $CONFIG_FILE | |
| cd $PROJECT_DIR | |
| export PATH=/usr/local/bin:$PATH | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <string.h> | |
| /* demonstrate pass by reference of an array of integers*/ | |
| void resize( int **p, int size ) { | |
| free( *p ); | |
| *p = (int*) malloc( size * sizeof(int) ); | |
| int tocpy[]= {8}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <string.h> | |
| /* demonstrate pass by reference of an array of integers*/ | |
| void resize( int **p, int size ) { | |
| free( *p ); | |
| *p = (int*) malloc( size * sizeof(int) ); | |
| int tocpy[]= {8}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <errno.h> | |
| int main(int argc, char *argv[]) | |
| { | |
| char* to_convert = argv[1]; | |
| char* p = NULL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cronjob: | |
| ======== | |
| * 1 * * * rsync -e 'ssh -v -i .ssh/log_coll_id_rsa logcol@server' -aP /var/log/mongodb/*.s server:. | |
| ### There results: | |
| On the server called server you will see in the home directory of the ssh user you created a directory with the log files for each host | |
| you installed the ssh key, the script and the cron job. | |
| ls ~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define _XOPEN_SOURCE | |
| #include <string.h> | |
| #include <time.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <locale.h> | |
| // in main() | |
| int |