Skip to content

Instantly share code, notes, and snippets.

@pfurio
pfurio / GetNordVPNWireGuardDetails.md
Created April 12, 2024 11:35 — forked from bluewalk/GetNordVPNWireGuardDetails.md
Getting NordVPN WireGuard details

About

Instructions to obtain WireGuard details of your NordVPN account. These can be used to setup a WireGuard tunnel on your router to NordVPN.

Source: https://forum.gl-inet.com/t/configure-wireguard-client-to-connect-to-nordvpn-servers/10422/27

Prerequisites

If you have any linux machine, use that or install a vm if you don't have one.

Get their official linux app installed. Make sure you have wireguard installed too. And set the used technology to Nordlynx by running nordvpn set technology nordlynx

@pfurio
pfurio / audit_login.py
Last active November 30, 2017 11:38
OpenCGA: Extract number of times every user logged in in a month
#!/usr/bin/env python
from pymongo import MongoClient
from bson import ObjectId
import datetime
import argparse
parser = argparse.ArgumentParser(description='Get the number of times each user have logged in during a period of time.')
parser.add_argument('host', metavar='host', help='Mongo host and port. Example: localhost:27017.')
# parser.add_argument('database', metavar='database', help='Mongo database name. Example: opencga_catalog.')
@pfurio
pfurio / #Opencga migration 1.1.x to 1.2.0
Last active September 15, 2017 12:11
OpenCGA migration scripts to move from release 1.1.x to 1.2.0
// 1. Load the function from https://gist.github.com/pfurio/f7cd90af08e0073699f0beeeef1958ba
// 2. Load all the scripts present in the gist in the CATALOG database
@pfurio
pfurio / removeSessions.js
Last active June 23, 2017 13:53
Remove old sessions (OpenCGA version < 1.2)
// Extracted from https://stackoverflow.com/questions/3066586/get-string-in-yyyymmdd-format-from-js-date-object
Date.prototype.opencgaDate = function() {
// We will get the current day minus 7 days
this.setDate(this.getDate() - 7);
var mm = this.getMonth() + 1; // getMonth() is zero-based
var dd = this.getDate();
return [this.getFullYear(),
(mm>9 ? '' : '0') + mm,
(dd>9 ? '' : '0') + dd,
@pfurio
pfurio / opencga-1.1.0-migration.js
Last active May 17, 2017 13:35
Opencga 1.1.0 migration
// Use migration script https://gist.github.com/pfurio/f7cd90af08e0073699f0beeeef1958ba
/*
Migrate NUMERIC variables to DOUBLE https://github.com/opencb/opencga/issues/545
*/
// This function receives an array of variables (not variableSet),
// and will modify NUMERIC variables to DOUBLE recursively
function modifyNumeric(variables) {
var modified = false;
@pfurio
pfurio / permissionMigration.js
Last active February 17, 2017 09:45
RC3 - 1.0.0-final catalog permission migration. This will need first https://gist.github.com/pfurio/f7cd90af08e0073699f0beeeef1958ba
migrateCollection("metadata", {}, {config: 1, acl: 1}, function (bulk, doc) {
var id = doc._id;
var permissions = ["VIEW_FILE_HEADERS", "VIEW_FILE_CONTENTS", "VIEW_FILES", "WRITE_FILES", "VIEW_JOBS", "WRITE_JOBS"];
doc.acl[0].permissions = permissions;
doc.config.acl[0].permissions = permissions;
bulk.find({_id: id}).update({$set: {"acl": doc.acl, "config.acl": doc.config.acl}});
});
@pfurio
pfurio / migrateCollection.js
Last active May 16, 2017 10:46
Base migration script
function migrateCollection(collection, query, projection, migrateFunc) {
var bulk = db.getCollection(collection).initializeOrderedBulkOp();
var count = 0;
var bulkSize = 500;
db.getCollection(collection).find(query,projection).forEach(function(doc) {
migrateFunc(bulk, doc);
if ( bulk.nUpdateOps + bulk.nInsertOps + bulk.nRemoveOps >= bulkSize ) {
count += bulk.nUpdateOps + bulk.nInsertOps + bulk.nRemoveOps;
print("Execute bulk! " + count);
bulk.execute();
@pfurio
pfurio / readPeaks.py
Created May 13, 2013 08:34
Get the counts for DNAse-seq experiments
# -*- coding: utf-8 -*-
# Author: Pedro Furió Tarí
# Data: 06/05/2013
#
# This script will take a sorted and indexed bam file and return different text files with the counts
# Useful when doing a trimming step for pair-end. After trimming, we have to make sure that we have the pairs correctly paired
import getopt, sys, os.path
import pysam