Skip to content

Instantly share code, notes, and snippets.

@bnlawrence
bnlawrence / mpi_v_example.py
Last active December 28, 2023 10:29
example of using mpi alltoall and alltoallv
from mpi4py import MPI
import numpy as np
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
nprocs = comm.Get_size()
DEBUG = 0
def move_info(info2move):
@yegappan
yegappan / VimScriptForPythonDevelopers.MD
Last active January 12, 2024 10:51
Vim script for Python Developers

Vim Script for Python Developers

This is a guide to Vim Script development for Python developers. Sample code for the various expressions, statements, functions and programming constructs is shown in both Python and Vim Script. This is not intended to be a tutorial for developing Vim scripts. It is assumed that the reader is familiar with Python programming.

For an introduction to Vim Script development, refer to usr_41.txt, eval.txt and Learn Vimscript the Hard Way

For a guide similar to this one for JavaScript developers, refer to Vim Script for the JavaScripter

This guide only describes the programming constructs that are present in both Python and Vim. The constructs that are unique to Vim (e.g. autocommands, [key-mapping](https://vimhelp.org/map.txt.html#key-m

@DIYer22
DIYer22 / addPageNumberToPDF.py
Last active July 24, 2023 19:41
Add Page Number to PDF file with Python(Python 给 PDF 添加 页码)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
helpDoc = '''
Add Page Number to PDF file with Python
Python 给 PDF 添加 页码
usage:
python addPageNumberToPDF.py [PDF path]
require:
@helo9
helo9 / xfoil.py
Last active November 26, 2023 02:53
use python to run xfoil analysis
# -*- coding: utf-8 -*-
import os
import numpy as np
import subprocess as sp
import re
def polar(afile, re, *args,**kwargs):
"""calculate airfoil polar and load results
@ingo-m
ingo-m / debian_install_cuda.md
Last active December 24, 2022 17:29
How to install CUDA on Debian

How to install CUDA on Debian 8 (Jessie)

This document describes how to install nvidia drivers & CUDA in one go on a fresh debian install.

Work in progress

Preparations

  • Start with a fresh Debian install.
@aubricus
aubricus / License
Last active June 20, 2023 01:19
Python Progress Bar
Copyright 2020 Aubrey Taylor
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTH
@santagada
santagada / prompt.xsh
Last active October 31, 2016 09:59
simple powerline for xonsh
import os
from collections import namedtuple
Section = namedtuple('Section', ['line', 'fg', 'bg'])
PARTS = 3
def cwd_sec():
cwd = $PWD
if cwd.startswith($HOME):
@ogrisel
ogrisel / haswell-n1-highmem-32-xeon-2.30GHz.txt
Last active May 27, 2016 13:33
Utility script to time the effective memory bandwidth of CPUs
model name : Intel(R) Xeon(R) CPU @ 2.30GHz
Loading arrays to memory
Loading speed: 0.670GB/s
timing bandwidth for sequential memory access
bandwidth: 9.0 GB/s
n_workers=2 (threads)
@say4n
say4n / LICENSE
Last active May 9, 2017 06:37
Just a plain simple boring xkcd comic downloader with download progress indicator.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2016 Sayan Goswami <goswami.sayan47@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@planetoftheweb
planetoftheweb / glyphicons.css
Created April 16, 2016 19:44
Bootstrap 4 code for including your own glyphicons
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../fonts/glyphicons-halflings-regular.eot');
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
.glyphicon {
position: relative;
top: 1px;
display: inline-block;