Skip to content

Instantly share code, notes, and snippets.

@steam228
steam228 / wosScopusMerge.r
Created November 29, 2021 16:25
R Bibliometrix WOS/SCOPUS merge
library(bibliometrix)
library(openxlsx)
setwd('/Volumes/PATHTO/')
getwd()
WOS_df <- convert2df(file = './WOS/wos.bib', dbsource = "wos", format = "bibtex")
SCOPUS_df <- convert2df(file = './SCOPUS/scopus.bib', dbsource = "scopus", format = "bibtex")
Merge_SCO_WOS <- mergeDbSources(SCOPUS_df, WOS_df, remove.duplicated=TRUE)
@phanan
phanan / runner.js
Last active May 8, 2024 08:44
Record a webpage with PhantomJS and FFMpeg
// Run this from the commandline:
// phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 24 -t 10 -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart output.mp4
var page = require('webpage').create(),
address = 'http://s.codepen.io/phanan/fullembedgrid/YPLewm?type=embed&safe=true&_t=1424767252279',
duration = 3, // duration of the video, in seconds
framerate = 24, // number of frames per second. 24 is a good value.
counter = 0,
width = 500,
height = 500;
@macagua
macagua / GourceGravatarExample.py
Created June 20, 2014 04:20
Python Gravatar Example for Gource software
# -*- coding: utf-8 -*-
#fetch Gravatars
# https://code.google.com/p/gource/wiki/GravatarExample
import os
import requests
import subprocess
import hashlib
@brianckeegan
brianckeegan / backbone_extractor.py
Last active August 2, 2023 19:26
Given a networkx graph containing weighted edges and a threshold parameter alpha, this code will return another networkx graph with the "backbone" of the graph containing a subset of weighted edges that fall above the threshold following the method in Serrano et al. 2008.
# Serrano, Boguna, Vespigani backbone extractor
# from http://www.pnas.org/content/106/16/6483.abstract
# Thanks to Michael Conover and Qian Zhang at Indiana with help on earlier versions
# Thanks to Clay Davis for pointing out an error
import networkx as nx
import numpy as np
def extract_backbone(g, weight='weight', alpha=.05):
backbone_graph = nx.Graph()
@tito
tito / bluetooth.py
Created November 12, 2013 15:28
Bluetooth example on Android using Python / Pyjnius
'''
Bluetooth/Pyjnius example
=========================
This was used to send some bytes to an arduino via bluetooth.
The app must have BLUETOOTH and BLUETOOTH_ADMIN permissions (well, i didn't
tested without BLUETOOTH_ADMIN, maybe it works.)
Connect your device to your phone, via the bluetooth menu. After the
pairing is done, you'll be able to use it in the app.
@aanastasiou
aanastasiou / README.MD
Created July 28, 2013 18:32
Generate a Cypher query to store a Python Networkx directed graph

Exporting a Networkx graph as a Cypher query

This little project defines a function that can be used to construct a Cypher query which when executed against a Neo4j database server will store the graph to the server.

Background

  • A Graph is an abstract mathematical model composed of Nodes connected through Edges that can be used to describe complex systems composed of a set of parts (corresponding to nodes) and their connections (corresponding to edges).
  • Examples of graphs are road networks (junctions connected via roads), electronic circuit networks (components and their connections) and others
  • Networkx is an excellent Python module for manipulating such Graph objects of any kind.
  • Neo4j is a graph database. It uses the Graph as a data model to store such objects to a data store.
@jbilcke
jbilcke / create_video.py
Last active July 25, 2023 07:14
How to create a video using Gephi + Scripting plugin + ffmpeg
execfile("/your/path/to/videomaker.py")
videomaker(
ts_min=1352261778000, # "from" timestamp..
ts_max=1352262378000, # .."to" timestamp
frames=20, # number of images in the video. eg 200 frames for a video at 20 frames per seconds = 10 seconds of video
output_prefix="/path/to/output/dir/frame_", # path where to write the png. images will be prefixed with "frame_"
output_format=".png" # you probably want to leave png here
)
@MoritzStefaner
MoritzStefaner / gist:3423911
Created August 22, 2012 09:02
Sample class for rendering a gephi layout with Java/processing
import java.io.File;
import java.io.FileNotFoundException;
import java.net.URISyntaxException;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.filters.api.FilterController;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Edge;
@underhilllabs
underhilllabs / delicious_scuttle_export.py
Created April 22, 2012 18:31
Export delicious bookmarks into a scuttle site
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# code originally from Michael Klier
# -- licensed unded CC-NC-SA
# http://www.splitbrain.org/blog/2010-12/12-from_scuttle_to_delicious
#
# 1. change username and password in urls below
# 2. change SCUTTLEDOMAIN to the domain of your scuttle site
@benjaminjackson
benjaminjackson / kickstarter_csv.rb
Created April 19, 2012 02:24
Screen Scraping Script for Kickstarter Projects
# Usage: ruby kickstarter_csv.rb output.csv
require 'rubygems'
require 'kickstarter'
LAST_REPORT_DATE = Date.parse("April 28, 2011")
FIELDS = [:name, :pledge_amount, :pledge_percent, :pledge_deadline, :owner]
def fetch_projects_for_category category, file