Skip to content

Instantly share code, notes, and snippets.

Avatar

Bartosz "mastier" Woronicz mastier

View GitHub Profile
@mastier
mastier / jenkins_subversion-plugin-2.5.7-maven.log
Last active Feb 26, 2016
Jenkins subversion-plugin maven log
View jenkins_subversion-plugin-2.5.7-maven.log
[INFO] Scanning for projects...
[WARNING] The POM for org.jenkins-ci.tools:maven-hpi-plugin:jar:1.106 is missing, no dependency information available
[WARNING] Failed to build parent project for org.jenkins-ci.plugins:subversion:hpi:2.5.7
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Jenkins Subversion Plug-in 2.5.7
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-hpi-plugin:1.96:validate (default-validate) @ subversion ---
[INFO]
@mastier
mastier / get_linked_files.py
Last active Feb 18, 2016
Get the list of used files starting from given index.html
View get_linked_files.py
from bs4 import BeautifoulSoup
def get_linked_files(filename, visited=set()):
visited.add(filename)
try:
soup = BeautifulSoup(open(filename).read(), 'html.parser')
tovisit = set([ x.attrs['href'] for x in soup.find_all('a')])
imgs = set([ x.attrs['src'] for x in soup.find_all('img')])
scripts = set([ x.attrs.get('src','') for x in soup.find_all('script')])
links = set([ x.attrs['href'] for x in soup.find_all('link')])
View cmdwrap.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
def run_cmd(*args):
process = subprocess.Popen(
args,
stdout=subprocess.PIPE,
View flatten_dict.py
# useful way to flatten dictionary representing i.e. path to file and content
# now fixed in case of running it again
def flatten_dict(d,path=(),paths=None, sep='/'):
if paths==None: paths=[]
if isinstance(d,dict):
for k,v in d.items():
flatten_dict(v,path+(k,),paths)
return paths
else: