Skip to content

Instantly share code, notes, and snippets.

var autobahn = require('autobahn');
var connection = new autobahn.Connection({url: 'ws://127.0.0.1:8080/ws', realm: 'realm1'});
connection.onopen = function (session) {
console.log("opened " + session);
// 4) call a remote procedure
session.call('com.math.slowsquare', [3]).then(
function (res) {
console.log("SlowSquare: ", res);
const w3cws = require('websocket').w3cwebsocket;
const wampy = require('wampy');
const ws = new wampy.Wampy('ws://127.0.0.1:8080/ws', { autoReconnect: false, ws: w3cws, realm: 'realm1' });
//exports.ws = ws;
//const wampy = require('./wampy_client.js');
//const ws = wampy.ws;
console.log('start');
@nutrino
nutrino / download-deb-packages.sh
Last active June 4, 2022 06:39
Download Debian/Ubuntu packages from online and install them to offline
apt-get download $(apt-rdepends $1|grep -v "^ " |grep -v "^libc-dev$" | sed 's/debconf-2.0/debconf/g')
@nutrino
nutrino / titleUrlMarkdownClip.js
Created January 6, 2020 06:29 — forked from bradleybossard/titleUrlMarkdownClip.js
Bookmarklet to copy current page title and url in Markdown format to clipboard, like [title](url) - Usual for posting links to resources in README.md files
javascript:(function() {
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
/*IE specific code path to prevent textarea being shown while dialog is visible.*/
return clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
@nutrino
nutrino / yumdown.sh
Last active September 11, 2024 09:28
RHEL/CentOS 7 Offline Download & Install Script
#!/bin/bashn
if [ -z "$1" ]; then
echo "sudo yumdown.sh [packageName]"
exit 1
fi
if [ "$EUID" -ne 0 ]
then echo "Please run as root (sudo yumdown.sh [packageName])"
exit
FOR /F "delims=~" %f in (requirements.txt) DO conda install --yes "%f" || pip install "%f"
while read requirement; do conda install --yes $requirement || pip install $requirement; done < requirements.txt
@nutrino
nutrino / conda_environment_rename.sh
Created November 13, 2020 08:48 — forked from Mukei/conda_environment_rename.sh
How to rename a conda environment (workaround)
#One workaround is to create clone environment, and then remove original one:
#(remember about deactivating current environment with deactivate on Windows and source deactivate on macOS/Linux)
conda create --name new_name --clone old_name --offline #use --offline flag to disable the redownload of all your packages
conda remove --name old_name --all # or its alias: `conda env remove --name old_name`
#There are several drawbacks of this method:
# time consumed on copying environment's files,
# temporary double disk usage.
if pgrep nexusd &> /dev/null; then
echo nexusd process already exists
else
nohup go/bin/nexusd -c go/etc/nexus.json 1>~/nexusd.log 2>&1 &
fi
@nutrino
nutrino / gist:ccd53f8cc08684dd6d547fe179ae9ddd
Created January 18, 2022 10:00
python install pkg : conda with pip
[requirements.txt]
while read requirement; conda install --yes $requirement;or pip install $requirement; end < requirements.txt
@nutrino
nutrino / gist:0468e041522fe010a22b330180feeddf
Last active April 16, 2022 13:14
List files older/later than specific time diff
# https://unix.stackexchange.com/a/10043
# List files later than 1 day diff
find . -maxdepth 1 -mtime -1
# List files older than 1 day diff
find . -maxdepth 1 -mtime +1