Skip to content

Instantly share code, notes, and snippets.

View verkholantsev's full-sized avatar

Aleksei Verkholantcev verkholantsev

  • Facebook
  • London, UK
View GitHub Profile
@verkholantsev
verkholantsev / trampoline.js
Created December 6, 2013 10:17
Trampoline implementation example
// http://jsfiddle.net/4yTPD/
debugger;
function sum (n) {
function nextStep (m, result) {
return function () {
if (m === 1) return result;
return nextStep(m-1, result + m);
}
}
@verkholantsev
verkholantsev / rename.sh
Last active August 29, 2015 14:02
Bulk rename
grep -r -l 'old' ./dir | xargs sed -i.bak "s/old/new/g"
sudo ssh -f -N -L 80:registry:80 user@host

source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/

openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]

What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.

Now let’s extract the certificate:

openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]

// First
condition && firstStatement()
// Goes to
if (conditon) {
firstStatement();
secondStatement();
}
// With
/**
* Реализация API, не изменяйте ее
* @param {string} url
* @param {function} callback
*/
function getData(url, callback) {
var RESPONSES = {
'/countries': [
{name: 'Cameroon', continent: 'Africa'},
{name :'Fiji Islands', continent: 'Oceania'},
npm info it worked if it ends with ok
npm verb cli [ '/Users/alex-vee/.nvm/versions/node/v4.3.1/bin/node',
npm verb cli '/Users/alex-vee/.nvm/versions/node/v4.3.1/bin/npm',
npm verb cli 'install',
npm verb cli '--loglevel',
npm verb cli 'silly' ]
npm info using npm@2.14.12
npm info using node@v4.3.1
npm verb readDependencies loading dependencies from /Users/alex-vee/tmp/npm-hangs-on-install/package.json
npm WARN package.json npm-hangs-on-install@1.0.0 No description