Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<style>
h1 {
font-family: Calibri;
}
</style>
</head>
<body>
<h1>Hello World!</h1>

Hello World

This is content converted from Markdown!

Here's a JSON sample:

{
  "foo": "bar"
}
@zyluo
zyluo / python_in_bash.sh
Last active December 7, 2018 21:15
Embedding python in bash script example
#/usr/bin/which sh
set -e
PRE_SOURCEFILE=$(mktemp)
$(which python) - "${0}" "${@}" "--source" "${PRE_SOURCEFILE}" "--prefix" "PRE" <<END
import argparse
import sys
import tempfile
@zyluo
zyluo / cdh6-postgresql.sh
Last active October 2, 2018 19:06
CDH6.0.0 Postgresql Database setup script
export PG_PASSWD="USE_UR_PASSWD"
for db_name in scm amon rman hue metastore sentry nav navms oozie; do sudo -u postgres psql -c "CREATE ROLE $db_name LOGIN PASSWORD '$PG_PASSWD';"; sudo -u postgres psql -c "CREATE DATABASE $db_name OWNER $db_name ENCODING 'UTF8';"; done
sudo -u postgres psql -c "SELECT rolname FROM pg_roles;" && sudo -u postgres psql -c "\l"
for db_name in metastore oozie; do sudo -u postgres psql -c "ALTER DATABASE $db_name SET standard_conforming_strings=off;"; done
sudo /opt/cloudera/cm/schema/scm_prepare_database.sh postgresql scm scm $DB_PASSWD
@zyluo
zyluo / tezos-baking-howto.md
Created July 8, 2018 23:02 — forked from dakk/tezos-baking-howto.md
tezos-baking-howto.md

Tezos baking howto

This howto is valid both for Betanet.

Setup

Prereq

You need gcc, m4, git, unzip, rsync and curl. In debian / ubuntu run:

@zyluo
zyluo / repo_update.sh
Last active January 2, 2016 13:39
OpenStack git repository update script
#!/usr/bin/env bash
# Copyright (c) 2014 Intel Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@zyluo
zyluo / nova-flags
Created January 19, 2012 10:43
OpenStack flag list
=== nova.image.s3.py ===
string('image_decryption_dir', '/tmp', 'parent dir for tempdir used for image decryption')
string('s3_access_key', 'notchecked', 'access key to use for s3 server for images')
string('s3_secret_key', 'notchecked', 'secret key to use for s3 server for images')
=== nova.compute.api.py ===
integer('find_host_timeout', 30, 'Timeout after NN seconds when looking for a host.')
=== nova.compute.manager.py ===
string('instances_path', '$state_path/instances', 'where instances are stored on disk')
@zyluo
zyluo / nova-test_db_api-run
Created December 19, 2011 13:29
nova run_tests.sh test_db_api
Failure
runTest ERROR
======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'test_db_api')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/joko/git/nova/.venv/local/lib/python2.7/site-packages/nose/loader.py", line 379, in loadTestsFromName
module = resolve_name(addr.module)
File "/home/joko/git/nova/.venv/local/lib/python2.7/site-packages/nose/util.py", line 331, in resolve_name
@zyluo
zyluo / test_db_api-edit
Created December 19, 2011 08:23
test_db_api change diff
diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py
index bfcc6b8..e11c0dd 100644
--- a/nova/tests/test_db_api.py
+++ b/nova/tests/test_db_api.py
@@ -273,8 +273,8 @@ class _DbApiTestCase(test.TestCase):
self.saved_db_imp = db.api.IMPL
self.saved_migration_imp = db.migration.IMPL
- db.api.IMPL = self.get_db_driver()
- db.migration.IMPL = self.get_migration_driver()
@zyluo
zyluo / horizon-depr-msg
Created December 13, 2011 02:02
Details of deprecated message attribute access in horizon (commit: 97dbcb2ba8521085773a24403c3199fc1e410ea7)
horizon/context_processors.py:64: except Exception, e:
horizon/dashboards/syspanel/users/views.py:51: except Exception, e:
horizon/dashboards/syspanel/users/forms.py:75: except Exception, e:
horizon/dashboards/syspanel/users/forms.py:86: except Exception, e:
horizon/dashboards/syspanel/flavors/views.py:54: except Exception, e:
horizon/dashboards/syspanel/quotas/views.py:39: except Exception, e:
horizon/dashboards/syspanel/instances/views.py:264: except Exception as e:
horizon/dashboards/syspanel/instances/views.py:293: except Exception as e:
horizon/dashboards/syspanel/tenants/views.py:52: except Exception, e:
horizon/dashboards/syspanel/tenants/forms.py:181: except Exception, e: