Skip to content

Instantly share code, notes, and snippets.

View ginixsan's full-sized avatar

Ginés Sanz Sanchis ginixsan

View GitHub Profile
@ginixsan
ginixsan / arduino_byte_array_to_string.cpp
Created February 3, 2023 18:29 — forked from nebulak/arduino_byte_array_to_string.cpp
arduino convert string to/from byte array
void setup(void)
{
}
void loop(void)
{
byte byteArray[5];
strcpy((char *)byteArray,"0123"); //init byte array, index 5 = \0
String myString = String((char *)byteArray);
}
@ginixsan
ginixsan / pubmed-publications.html
Created June 3, 2023 15:55 — forked from slowkow/pubmed-publications.html
Get an HTML list of PubMed publications
<!DOCTYPE html>
<body>
<!-- Copied directly from http://www.ephys.org/ by Damian J Williams -->
<input placeholder="Kamil Slowikowski" name="name"/>
<p id="demo"></p>
<script>
@ginixsan
ginixsan / search_biopython.py
Created June 3, 2023 15:57 — forked from bonzanini/search_biopython.py
Searching PubMed with Biopython
# This code uses Biopython to retrieve lists of articles from pubmed
# you need to install Biopython first.
# If you use Anaconda:
# conda install biopython
# If you use pip/venv:
# pip install biopython
# Full discussion:
@ginixsan
ginixsan / ImpactHunter.py
Created June 3, 2023 15:57 — forked from SemiQuant/ImpactHunter.py
Summarize the publication of a researcher, and calculate their IFs for first and last authorships in a data range
#!/bin/python
from Bio import Entrez
import subprocess
import ast
import statistics
def search_publications(author_name, start_year, end_year):
# Search PubMed for publications by the author within the specified date range
query = f'({author_name}[Author]) AND (Journal Article[Publication Type]) NOT (Clinical Trial[Publication Type]) NOT preprint[pt] NOT review[pt] AND ({start_year}:{end_year}[PDAT])'
handle = Entrez.esearch(db='pubmed', term=query)
record = Entrez.read(handle)
import os
import re
import gzip
import hashlib
from tqdm import tqdm
from bs4 import BeautifulSoup, SoupStrainer
fnames = []
for fname in os.listdir('PubMed'):
if fname.endswith('.xml'):
import sys
import openai
import json
import pandas as pd
from Bio import Entrez
from datetime import datetime
from PyQt6 import QtWidgets, QtGui
from PyQt6.QtCore import Qt
# Replace with your own ChatGPT API key
@ginixsan
ginixsan / parse_pubmed.py
Created June 3, 2023 15:58 — forked from jasonrig/parse_pubmed.py
Verify and extract abstracts from PubMed
import csv
import glob
import gzip
import hashlib
import xml.sax
import tqdm
file_list = glob.glob("./pubmed/*.xml.gz")
@ginixsan
ginixsan / xml_split.py
Created June 13, 2023 15:06 — forked from benallard/xml_split.py
Small python script to split huge XML files into parts. It takes one or two parameters. The first is always the huge XML file, and the second the size of the wished chunks in Kb (default to 1Mb) (0 spilt wherever possible) The generated files are called like the original one with an index between the filename and the extension like that: bigxml.…
#!/usr/bin/env python
import os
import xml.parsers.expat
from xml.sax.saxutils import escape
from optparse import OptionParser
from math import log10
# How much data we process at a time
@ginixsan
ginixsan / remove_silence.py
Created December 20, 2023 07:08 — forked from sotelo/remove_silence.py
Remove silences
# From https://stackoverflow.com/questions/29547218/
# remove-silence-at-the-beginning-and-at-the-end-of-wave-files-with-pydub
from pydub import AudioSegment
def detect_leading_silence(sound, silence_threshold=-50.0, chunk_size=10):
'''
sound is a pydub.AudioSegment
silence_threshold in dB
chunk_size in ms
@ginixsan
ginixsan / podforceupdate.sh
Created April 8, 2024 15:26 — forked from mbinna/podforceupdate.sh
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update