Skip to content

Instantly share code, notes, and snippets.

View euccas's full-sized avatar

Euccas Chen euccas

View GitHub Profile
@euccas
euccas / Jenkinsfile.groovy
Last active June 8, 2020 02:05 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@euccas
euccas / quicksort.rb
Last active June 8, 2020 00:14
Here are some things you can do with Gists in GistBox.
# Use Gists to store entire functions
class QuickSort
def self.sort!(keys)
quick(keys,0,keys.size-1)
end
private
def self.quick(keys, left, right)
#!/usr/bin/env ruby
USAGE=<<EOS
Delete files in specified folders that are older than a given number of days.
Options:
-v - verbose. Will list folders and files.
-d - dry run. Like verbose, but does not delete files.
-h - Show this usage help.
Arguments: