Skip to content

Instantly share code, notes, and snippets.

View amrhamedp's full-sized avatar

amr abdallah amrhamedp

  • Basel University
View GitHub Profile
@amrhamedp
amrhamedp / numpy-sqlite3.py
Created December 27, 2017 06:10 — forked from pnavarro-algometrics/numpy-sqlite3.py
Insert numpy array into a sqlite3 database
import sqlite3
import numpy
# Array of 4 columns and 100 rows
data = numpy.random.rand(100, 4)
# Create a sample database
conn = sqlite3.connect('/tmp/sample.db')
cursor = conn.cursor()
@amrhamedp
amrhamedp / conf_gen.py
Created July 29, 2017 14:38 — forked from tdudgeon/conf_gen.py
Conformer generation using RDKit
import sys
from rdkit import Chem
from rdkit.Chem import AllChem, TorsionFingerprints
from rdkit.ML.Cluster import Butina
def gen_conformers(mol, numConfs=100, maxAttempts=1000, pruneRmsThresh=0.1, useExpTorsionAnglePrefs=True, useBasicKnowledge=True, enforceChirality=True):
ids = AllChem.EmbedMultipleConfs(mol, numConfs=numConfs, maxAttempts=maxAttempts, pruneRmsThresh=pruneRmsThresh, useExpTorsionAnglePrefs=useExpTorsionAnglePrefs, useBasicKnowledge=useBasicKnowledge, enforceChirality=enforceChirality, numThreads=0)
return list(ids)
@amrhamedp
amrhamedp / FileRead.cpp
Created July 29, 2017 05:09 — forked from skymarionsky/FileRead.cpp
read file and do something line by line with c++
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
int main(int argc, char* argv[])
{
ifstream file(argv[1]); // pass file name as argment
string linebuffer;
@amrhamedp
amrhamedp / 0_reuse_code.js
Created April 17, 2017 06:53
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console