Skip to content

Instantly share code, notes, and snippets.

View Mahdisadjadi's full-sized avatar

mahdi sadjadi Mahdisadjadi

View GitHub Profile
@jiahao
jiahao / Optimizer.py
Created January 4, 2012 17:44
Pure Python implementation of some numerical optimizers
#!/usr/bin/env python
'''
Pure Python implementation of some numerical optimizers
Created on Jan 21, 2011
@author Jiahao Chen
'''
@baojie
baojie / hello_multiprocessing.py
Created July 21, 2013 07:04
Python multiprocessing hello world. Split a list and process sublists in different jobs
import multiprocessing
# split a list into evenly sized chunks
def chunks(l, n):
return [l[i:i+n] for i in range(0, len(l), n)]
def do_job(job_id, data_slice):
for item in data_slice:
print "job", job_id, item
@jhjensen2
jhjensen2 / opt.py
Last active August 5, 2021 18:43
This python program extracts coordinates and gradients from a GAMESS output file and creates a .xyz+vib file. Note that the sign of the gradient is changed to produce the force To use it type (assuming opt.py and the output file is in the same directory): python opt.py x xx > xxx.xyz where x is the number of atoms in the molecule and xx is the n…
"""\
This python program extracts coordinates and gradients from a GAMESS output
file and creates a .xzy+vib file. Note that the sign of the gradient is chaged to produce the force
To use it type (assuming opt.py and the output file is in the same directory):
python opt.py x xx > xxx.xyz
where x is the number of atoms in the molecule and xx is the name of the GAMESS output file. xxx is whatever you want to call your xyz file.
@CloudCray
CloudCray / colorize_zipcodes.py
Last active August 13, 2018 03:26
Download all US Zip Code Tabulation Area shapefiles (ZCTA) with Python 3
"""
Author: Cloud Cray
Date: 2014-01-04
This is an example script to read Zip Code data from a US shapefile,
then colorize all zip codes, then save the result to a png file.
"""
import shapefile
import matplotlib.patches as patches
@xdamman
xdamman / install_ffmpeg_ubuntu.sh
Created July 2, 2014 21:03
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@subfuzion
subfuzion / global-gitignore.md
Last active June 3, 2026 01:10
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.

@amroamroamro
amroamroamro / README.md
Last active April 14, 2026 07:07
[Python] Fitting plane/surface to a set of data points

Python version of the MATLAB code in this Stack Overflow post: https://stackoverflow.com/a/18648210/97160

The example shows how to determine the best-fit plane/surface (1st or higher order polynomial) over a set of three-dimensional points.

Implemented in Python + NumPy + SciPy + matplotlib.

quadratic_surface

@kageurufu
kageurufu / __init__.py
Created May 21, 2015 19:17
Example of loading large data in memory
from flask import Flask
app = Flask(__name__)
from . import views
@jgomezdans
jgomezdans / HessianCalculations.ipynb
Last active September 18, 2015 06:30
Hessian calculation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wmedlar
wmedlar / Tight-Binding Calculation of the Band Structure of Silicon.ipynb
Last active October 23, 2025 09:49
The band structure of Silicon is calculated using the empirical tight-binding method implemented in the Python programming language. Only interactions between first nearest neighbors are taken into account. The energy splittings for Silicon at symmetry points appear to be somewhat accurate to accepted values, although second neighbors will have …
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.