This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM tomcat:8.0.38 | |
# Place the code version inside the webapps directory | |
ARG PACKAGE_VERSION | |
RUN echo "${PACKAGE_VERSION}" >> /usr/local/tomcat/webapps/version.txt | |
COPY project.war /usr/local/tomcat/webapps/project.war | |
COPY docker-entrypoint.sh / | |
RUN chmod +x /docker-entrypoint.sh | |
ENTRYPOINT ["/docker-entrypoint.sh"] |
This file contains 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
/* | |
* A simple client that opens a socket. | |
*/ | |
#include <stdio.h> | |
#include <sys/socket.h> | |
int main(int argc, char *argv[]) | |
{ | |
int sockfd; |
This file contains 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
<!-- Simple webpage for Django UI example test --> | |
<html> | |
<head> | |
</head> | |
<body> | |
<p id="test">Hello World!</p> | |
</body> | |
</html> |
This file contains 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
/** | |
* Code snippet that tries to create a connection with the given wmiLocator object to the given namespace. | |
* @return An IJIDispatch object that can be used for WQL queries to the given namesapce of the target machine. | |
* @Exception In case the ConnectServer method could not be properly executed. | |
*/ | |
public IJIDispatch createNamespaceServer(IJIDispatch wmiLocator, String nameSpace, String ipAddress) throws Exception | |
{ | |
// create an instance of the WbemScripting.SWbemLocator object to talk to WMI on the target machine. | |
// namespace could be for instance "root\\cimv2" | |
JIVariant results[] = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A simple django project deployment script for jenkins | |
BUILD_ROOT="/srv/www/django/d_project/" | |
MNGR=${BUILD_ROOT}"manage.py" | |
# source python env | |
echo "Sourcing python env..." | |
source ${BUILD_ROOT}"py-env/bin/activate" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Using Fermat's little theorem to calculate nCk mod m, for k < m and m is prime | |
Two versions: | |
1. Pre-Compute factorials and multiplicative inverses in O(n*logn) --> later lookup in O(1) | |
2. Compute directly --> no lookup --> each time O(n) | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Iterate over each subset of any size (Power set) | |
""" | |
def power_set(A): | |
subsets = [] | |
N = len(A) | |
# iterate over each subset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
A simple python(3) bf interpreter. | |
First argument is .bf file with code to execute. | |
Optionally a file with input arguments can be specified as second argument. | |
""" | |
import sys | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SENSITIVE_FILES="roles/ssh/templates/sshd_config.j2.enc" | |
if [ "$1" != "clean" ] && [ "$1" != "decrypt" ] | |
then | |
echo "only 'clean' or 'decrypt' are allowed" | |
exit 1 | |
fi |
This file contains 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
sshd_port: 5133 | |
sshd_groups: | |
- name: devops | |
ssh: | |
allow_tcp_fwd: True | |
allow_agent_fwd: True | |
x11_fwd: True | |
- name: developers | |
ssh: |