Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
#!/bin/bash | |
### | |
### my-script — does one thing well | |
### | |
### Usage: | |
### my-script <input> <output> | |
### | |
### Options: | |
### <input> Input file to read. | |
### <output> Output file to write. Use '-' for stdout. |
# Put this function to your .bashrc file. | |
# Usage: mv oldfilename | |
# If you call mv without the second parameter it will prompt you to edit the filename on command line. | |
# Original mv is called when it's called with more than one argument. | |
# It's useful when you want to change just a few letters in a long name. | |
# | |
# Also see: | |
# - imv from renameutils | |
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste) |
import cloudinary | |
import cloudinary.uploader | |
import cloudinary.api | |
import cloudinary.utils | |
import argparse | |
import sys, os, glob, re | |
import urllib.parse | |
cloudinary.config( | |
cloud_name = '<<your cloud-name>>', |
#!/usr/bin/env python | |
''' | |
Simple and functional REST server for Python (3.5) using no dependencies beyond the Python standard library. | |
Ported from original lib for Python 2.7 by Liron (tliron @ github.com) https://gist.github.com/tliron/8e9757180506f25e46d9 | |
Features: | |
* Map URI patterns using regular expressions | |
* Map any/all the HTTP VERBS (GET, PUT, DELETE, POST) | |
* All responses and payloads are converted to/from JSON for you | |
* Easily serve static files: a URI can be mapped to a file, in which case just GET is supported |
import asyncio | |
loop = asyncio.get_event_loop() | |
async def hello(): | |
await asyncio.sleep(3) | |
print('Hello!') | |
if __name__ == '__main__': | |
loop.run_until_complete(hello()) | |
Additional Questions from Career-cup | |
Company selected Google, | |
Sorted by most comments | |
1.Partition integer array respect to zero, i.e. negative ... 0 ... positive, keep relative order | |
E.g. -1 1 3 -2 2 => -1 -2 1 3 2. | |
2. Search in 2D matrix, | |
Given each row and column sorted, or given for each (i,j) A[i][j] < A[i][j+1] & A[i][j] < A[i+1][j] |
function deleteSavedItems() { | |
var query = document.querySelectorAll("#sc-saved-cart input[value=Delete]") | |
if (query.length) { | |
query[0].click(); | |
} | |
if (query.length > 1) { | |
setTimeout(deleteSavedItems,100); | |
} | |
else { | |
console.log('Finished'); |
Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
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" |