Skip to content

Instantly share code, notes, and snippets.

import os
import shutil
import hashlib
from datetime import datetime
def get_file_hash(file_path):
"""Calculate the SHA-256 hash of a file."""
with open(file_path, 'rb') as f:
return hashlib.sha256(f.read()).hexdigest()
@bbelanger
bbelanger / is_var_set.sh
Created November 14, 2015 05:42
Linux - Check if 'var' is set.
#!/bin/bash
# check if var, RELEASE in this example, is set
if [ -z ${RELEASE+x} ]
then
echo "RELEASE is unset"
else
echo "RELEASE is set to '$RELEASE'"
fi
@bbelanger
bbelanger / README.md
Created October 23, 2015 18:34 — forked from jxson/README.md
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@bbelanger
bbelanger / cygwin-mirror-speed.py
Last active September 20, 2015 17:00 — forked from ushkinaz/cygwin-mirror-speed.py
Tests speed of http mirrors of cygwin
#!/usr/bin/env python3
"""
Tests http mirrors of cygwin
"""
import random
import time
from urllib.request import urlopen
import sys
__author__ = 'Dmitry Sidorenko'
@bbelanger
bbelanger / workflow.groovy
Last active September 16, 2015 16:18 — forked from cyrille-leclerc/workflow.groovy
continuous-lifecycle.de 14 - Pimp Your Continuous Delivery Pipeline with the New Jenkins Workflow Engine
def qaCatalinaBase = '/opt/apache-tomcat-8-qa'
def qaHttpPort = 8081
def stagingCatalinaBase = '/opt/apache-tomcat-8-staging'
def stagingHttpPort = 8082
def perfsCatalinaBase = '/opt/apache-tomcat-8-perfs'
def perfsHttpPort = 8084
def productionCatalinaBase = '/opt/apache-tomcat-8-production'
@bbelanger
bbelanger / workflow.groovy
Last active September 16, 2015 16:06 — forked from cyrille-leclerc/workflow.groovy
W-JAX 14- Pimp Your Continuous Delivery Pipeline with the New Jenkins Workflow Engine
def qaCatalinaBase = '/opt/apache-tomcat-8-qa'
def qaHttpPort = 8081
def stagingCatalinaBase = '/opt/apache-tomcat-8-staging'
def stagingHttpPort = 8082
def perfsCatalinaBase = '/opt/apache-tomcat-8-perfs'
def perfsHttpPort = 8084
def productionCatalinaBase = '/opt/apache-tomcat-8-production'
@bbelanger
bbelanger / Install_Sublime_Text_3.sh
Last active August 29, 2015 14:27 — forked from dkd903/Install_Sublime_Text_3.sh
Install Sublime Text 3 editor on Fedora Linux & Red Hat Linux - 32 Bit Edition. More at: http://digitizor.com/?p=15885
#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 3
Comment=Edit text files
Exec=/usr/local/sublime-text-3/sublime_text
Icon=/usr/local/sublime-text-3/Icon/128x128/sublime_text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
@bbelanger
bbelanger / jdk_download.sh
Last active August 29, 2015 14:25 — forked from P7h/jdk_download.sh
Commands / shell script to download JDK / JRE / Java binaries from Oracle website from terminal / shell / command line / command prompt.
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget.
### You can download all the binaries one-shot by just giving the BASE_URL.
### Script might be useful if you need Oracle JDK on Amazon EC2 env.
### Script is updated for every JDK release.
### Features:-
# 1. Resumes a broken / interrupted [previous] download, if any.
# 2. Renames the file to a proper name with including platform info.
// http://www.slideshare.net/nzakas/scalable-javascript-application-architecture
// http://addyosmani.com/largescalejavascript/
// http://boilerplatejs.org/
// http://rmurphey.com/blog/2009/10/15/using-objects-to-organize-your-code/
// http://stackoverflow.com/questions/11842923/organizing-javascript-code
// http://stackoverflow.com/questions/247209/current-commonly-accepted-best-practices-around-code-organization-in-javascript
// http://msdn.microsoft.com/en-us/magazine/gg602402.aspx
// https://coderwall.com/p/b5jutw
// http://alexsexton.com/blog/2010/02/using-inheritance-patterns-to-organize-large-jquery-applications/
.mt0 { margin-top: 0px; }
.mt5 { margin-top: 5px; }
.mt10 { margin-top: 10px; }
.mt20 { margin-top: 20px; }
.mt30 { margin-top: 30px; }
.mt40 { margin-top: 40px; }
.mt50 { margin-top: 50px; }
.mb0 { margin-bottom: 0px; }
.mb5 { margin-bottom: 5px; }