Posts

sed - Bash: How to Remove Multiple Prefix Variants From a String -

i'm trying remove prefix of url string parsed package.json file using bash. issue found not enters repository:url consistently in package files. e.g.: git+https://github.com/<user>/<repo>.git https://github.com/<user>/<repo>.git and have found: http://github.com/<user>/<repo>.git so question is, how remove either string prefix might found in .json? below unsuccessful attempt. repo_url="`node -pe 'json.parse(process.argv[1]).repository.url' "$(cat $pkg_json)"`" repo=${repo_url#git+} repo=${repo_url#https://github.com/} repo=${repo%.git} echo "${repo}" update: i discovered adding wildcard before prefix eliminate before , including prefix. how handle http ? e.g.: repo=${repo_url#*https://github.com/} each of assignments repo uses original $repo_url source, removals previous assignment aren't maintained. should use $repo source, except first one: repo_url="`node -...

php - Where should the credentials for mysql be put? -

logging mysql database requires credentials. have these credentials in php class called class.dbone.php . this in git repo on server. use push deploy. i want share repo contract devs, don't want them have access credentials. how mitigate this? are credentials supposed be? here snippet: <?php // creates 1 instance of database class dbone { private $db_user = 'foo'; private $db_pass = 'foo'; private $db_driver = 'mysql:dbname=foo;host=localhost'; // singleton uses static variable ensure 1 instance @ time private static $database; private function __construct() { $this->checkforcleardb(); // self::checkforclearpostgres(); try { // instaniate database connection self::$database = new pdo( $this->db_driver, $this->db_user, $this->db_pass ); } catch( pdoexception $pdoerror ) { ...

c# - Getting height/width from a unity gameobject -

i'm working on version of conway's game of life in unity, , here setup making grid: i've created prefab of individual cell responding mouse click basis creating cell grid. have empty gameobject act controller create grid. i'm putting in code controller so, pointing prefab field: [serializefield] private gameobject cell; private camera _camera; my idea dimensions of cell , instantiate grid, _camera pointing main camera boundaries. however, i'm not sure how height/width gameobject. what's best way find out? i don't know if found answer, common way using collider (if have one, mouse click needs it) or renderer (if have mesh) using: getcomponent<collider>().bounds.size getcomponent<renderer>().bounds.size game of life nice, i've written paper bachelor seminar it. have fun!

linux - Ansible "missing become password" on one machine but not another -

the situation this: machine on target machine b, run below shell code , completes successfully. machine on target machine c, run below shell code , gives me "become password missing". can log both machine , b credentials without being prompted sudo password or anything. i go ansible.cfg , uncomment ask_sudo_pass , causes code prompt me sudo password request. however, want automate dozens of machines, can't enter sudo password every 1 every time use this. i'm in process of setting ssh keys these machines, there's been delays there need way automate in short term. suggestions please? these shell commands i'm using: export ansible_host_key_checking=false sshpass -p ${ssh_password} ansible-playbook -i hosts site.yml -u ${ssh_username} --extra-vars="ssh_user=${ssh_username}" i remove password of user on target passwd --delete username and rely on id_rsa connect, of course "username" on target part of wheel group. you can...

dependency injection - gcc linking of shared libraries: secondary dependencies with $ORIGIN -

this follow-up question this one . i understand using $origin in -rpath option generates dynamic absolute path point specified location - no matter use library. what's confusing me, following: use library generate shared binary , set (again) -wl,-rpath option using $origin enable binary find library. original $origin value of library not available anymore or wrong because seems overwritten new one. somehow understandable since generating new shared object - binary - has own $origin . way around this, provide binary's -rpath both locations, 1 library , 1 library needs. in opinion makes -rpath useless, because can't link library , specify location need specify library's dependency location. my question: there way specify hierarchical -rpath values using $origin ? avoid absolute paths, fix issue.

javascript - Babel: The CLI has been moved into the package `babel-cli` -

i working on js file @ work had babel installed, running babel file.js | node sent file home work in evening, installed babel @ home , got following error when run above command: the cli has been moved package 'babel-cli' any ideas? thank in advance :) if install cli - following code fails compile: function sumarrayindex(array, i, separator) { return array .map(x => x.split(separator) .map(c => { return parseint(c) }) ) .map(x => { return x[i]; }) .reduce((x, y) => { return x += y }, 0); } function mintosec(m) { return m * 60 } function secondstominutesandseconds(s) { var min = s / 60; var sec = s % 60; minutes += math.floor(min); seconds += sec; } function outputtime() { return hours + ':' + minutes + ':' + seconds; } babel version 6 split project several modules. message indicates cli has moved babel-cli . i suggest use same version use @ work (which v5): npm install -g babel@5 ho...

debug spring boot in vagrant and docker -

i'm trying setup development environment spring-boot project based on docker , vagrant. i'm using intellij running on windows write code , vagrant able run project in docker containers on system. i'm building project maven. i'm able run application packaged in jar in docker container running in ubuntu on virtualbox via vagrant. cannot figure out how debug application in intellij, start application remote debugging on, correctly (or @ least think i'm doing right) configure port forwarding, intellij still tells me "connection reset" , cannot connect debugger. here dockerfile: from java:8 volume /tmp add test-1.0-snapshot.jar app.jar entrypoint ["java", "-djava.security.egd=file:/dev/./urandom", "-xdebug -xrunjdwp:server=y,transport=dt_socket,suspend=n,address=8000", "-jar", "/app.jar"] vagrantfile: env['vagrant_default_provider'] = 'docker' vagrant.configure("2") |config...