Skip to content

Instantly share code, notes, and snippets.

View silvtal's full-sized avatar

Silvia Talavera Marcos silvtal

View GitHub Profile
@lukelbd
lukelbd / pdf-recolor.py
Last active October 7, 2022 20:48
Script to change the color of the highlight annotations in PDF document(s).
#!/usr/bin/env python
"""
Change the color of the highlight annotations in PDF document(s).
The destination color is hardcoded in this script.
"""
# Adapted from:
# https://unix.stackexchange.com/a/118492/112647
# PDF format reference:
# http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf
# pages 12 to 13 define the character sets
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active July 24, 2024 07:10
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@dosorio
dosorio / install_sybilSBML.sh
Last active August 1, 2023 19:34
Commands to install sybilSBML R package on MacOS/Linux
wget https://downloads.sourceforge.net/project/sbml/libsbml/5.17.0/stable/libSBML-5.17.0-core-plus-packages-src.tar.gz
tar -xxvf libSBML-5.17.0-core-plus-packages-src.*
cd libSBML-5.17.0-Source
./configure --prefix=/usr/local/ \
--enable-cpp-namespace \
--enable-fbc \
--enable-shared \
--with-gnu-ld \
--enable-layout \
--enable-comp \
@saurabhshri
saurabhshri / pip.md
Last active June 7, 2024 12:58
Install and use pip in a local directory without root/sudo access.

Install and use pip in a local directory without root/sudo access.

Why?

Many users when are given server access, do not have root (or sudo) privileges and can not simply do sudo apt-get install python-pip . Here's an easy way you can install and use pip without root (or sudo) access in a local directory. Note : This works without easy_install too.

How?

@zakandrewking
zakandrewking / advanced_search_scrape.py
Last active May 29, 2023 11:26
Get BiGG compounds for KEGG IDs from BiGG Models
import requests
import re
response = requests.post(
'http://bigg.ucsd.edu/advanced_search_external_id_results',
data={'database_source': 'kegg.compound', 'query': 'C00234'}
)
try:
print re.search(r'/models/universal/metabolites/([^"]+)', response.text).group(1)
@msrose
msrose / combining-git-repositories.md
Last active July 8, 2024 16:41
How to combine two git repositories.

Combining two git repositories

Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:

  • preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
  • actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location

NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.

Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.

@CrookedNumber
CrookedNumber / gist:8964442
Created February 12, 2014 21:02
git: Removing the last commit

Removing the last commit

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard": git reset HEAD^ which will evict the commits from the branch and from the index, but leave the working tree around.

If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.