Skip to content

Instantly share code, notes, and snippets.

cat json > python -m json.tool
iSCSI Initiator Install
To configure Ubuntu Server as an iSCSI initiator install the open-iscsi package. In a terminal enter:
sudo apt install open-iscsi
iSCSI Initiator Configuration
Once the open-iscsi package is installed, edit /etc/iscsi/iscsid.conf changing the following:
node.startup = automatic
You can check which targets are available by using the iscsiadm utility. Enter the following in a terminal:
# create a disk-image
root@dlp:~# mkdir /var/lib/iscsi_disks
root@dlp:~# dd if=/dev/zero of=/var/lib/iscsi_disks/disk01.img count=0 bs=1 seek=10G
root@dlp:~# vi /etc/tgt/conf.d/target01.conf
# add to the end
# naming rule : [ iqn.yaer-month.domain:any name ]
<target iqn.2017-04.world.srv:target01>
# provided devicce as a iSCSI target
backing-store /var/lib/iscsi_disks/disk01.img
# iSCSI Initiator's IP address you allow to connect
def func1(x, y, z):
print x
print y
print z
def func2(*args):
# Convert args tuple to a list so we can modify it
args = list(args)
args[0] = 'Hello'
args[1] = 'awesome'
package com.journaldev.hibernate.main;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import com.journaldev.hibernate.model.Address;
import com.journaldev.hibernate.model.Employee;
import com.journaldev.hibernate.util.HibernateUtil;
package com.journaldev.hibernate.main;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import com.journaldev.hibernate.model.Address;
import com.journaldev.hibernate.model.Employee;
import com.journaldev.hibernate.util.HibernateUtil;
@vy-nguyen
vy-nguyen / gist:64539cda22b73f8aedea
Last active March 14, 2016 04:48
Reflux examples
http://blog.mojotech.com/react-and-reflux-in-5-minutes/
var Reflux = require('reflux');
var ContentReviewerActions = Reflux.createActions({
// Child actions 'completed' and 'failed' are called by resolution of listenAndPromise
"loadReview": { children: ['completed', 'failed'] },
"updateStatus": {},
"submitReview": {}
});
@vy-nguyen
vy-nguyen / gist:b214bdc402edab61147a
Last active March 16, 2016 08:31
Login example
App.Users.Add = React.createClass({
getInitialState: function () {
return {username: "", email: "", password: "", loading: false, errors: {}}
},
_create: function () {
return $.ajax({
url: '/api/users',
type: 'POST',
data: {
username: this.state.username,
@vy-nguyen
vy-nguyen / Same react code
Last active March 5, 2016 17:54
React sample code
var Login = React.createClass({
mixins: [Reflux.listenTo(userStore, 'resetForm')],
resetForm: function() {
this.setState({
submitted: false,
});
this.refs.email.getDOMNode().value = '';
this.refs.password.getDOMNode().value = '';
var ProductsApi = {
loadAll: function() {
return APIUtils.get('/products');
}
};
var ProductActions = Reflux.createActions(['loadAll', 'loadAllComplete']);
ProductActions.loadAll.preEmit = function() {
ProductsApi.loadAll().then(ProductActions.loadAllComplete);
};