Skip to content

Instantly share code, notes, and snippets.

@Chengcheng-Xiao
Chengcheng-Xiao / v_sim_macports.md
Last active February 1, 2023 08:21
Compile v_sim with macports

Use macports to install:

sudo port install gtk2 +x11

(NOTE) we are going to need mp-gcc for this:

sudo port install mp-gcc10
sudo port select --set gcc mp-gcc10
sudo port install intltool
sudo port install pkgconfig
@baymaxium
baymaxium / content.md
Created October 18, 2017 08:53
Python-mode:在 Vim 编辑器中开发 Python 应用的 Vim 插件

原文:Linux中国

Python-mode 是一个 Vim 插件,它使你能够在 Vim 编辑器中更快的利用包括 pylint、rope、pydoc、pyflakes、pep8、autopep8、pep257 和 mccable 在内的各种库来写 Python 代码,这些库提供了一些编码功能,比如静态分析、特征重构、折叠、补全和文档等。

-- Aaron Kili

本文导航

@ashander
ashander / comet-and-conda-errors.md
Last active June 6, 2023 01:12
Error attempting to use numpy via conda on SDSC's Comet resource --- due to default number of threads requested by OpenMP

The error below can be avoided by export OMP_NUM_THREADS=2 (or possibly a higher number). To see this run:

env OMP_NUM_THREADS=2 python -c 'import numpy'

environment

system

@littlecodersh
littlecodersh / WechatSmartWish.py
Created September 28, 2016 03:01
Demo of sending smart wishes through wechat.
#coding=utf8
import itchat, time
SINCERE_WISH = u'祝%s新年快乐!'
REAL_SINCERE_WISH = u'祝%s新年快乐!!'
def send_wishes():
friendList = itchat.get_friends(update=True)[1:]
for friend in friendList:
# 如果不是演示目的,把下面的方法改为itchat.send即可
@ryerh
ryerh / tmux-cheatsheet.markdown
Last active May 14, 2024 02:51 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

@alexpearce
alexpearce / offset_text.py
Last active November 5, 2020 07:03
Nice offset label formatting in matplotlib. See [the blog post](https://alexpearce.me/2014/04/exponent-label-in-matplotlib/) for more.
import numpy as np
from matplotlib import pyplot as plt
fig = plt.figure(figsize=(5, 4))
# Generate some data
mu, sigma = 1e7, 1e6
s = np.random.normal(mu, sigma, 10000)
# Plot it
plt.hist(s, 30, histtype='step')
# Format it
@revolunet
revolunet / backup.py
Last active October 14, 2022 22:12
download your google drive files with python
# -*- encoding: UTF-8 -*-
import os
import httplib2
# pip install --upgrade google-api-python-client
from oauth2client.file import Storage
from apiclient.discovery import build
from oauth2client.client import OAuth2WebServerFlow
@rossant
rossant / raytracing.py
Last active December 24, 2023 12:50
Very simple ray tracing engine in (almost) pure Python. Depends on NumPy and Matplotlib. Diffuse and specular lighting, simple shadows, reflections, no refraction. Purely sequential algorithm, slow execution.
"""
MIT License
Copyright (c) 2017 Cyrille Rossant
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
@benjamine
benjamine / README.md
Last active December 9, 2021 22:46
Delete your fork master branch, useful when using feature branches

When working with feature branches, the master branch on your fork becomes useless (you probably base your branches on upstream/master). As a result you fork's master gets outdated, and can lead to mistakes.

Deleting it is a good idea, but github needs a "default branch" to show on website, this script will create an orphan "_default" branch with just an explanatory README.md on it, and set that as default for github (you'll be asked your github password).

DISCLAIMER: This script will delete your master branch locally and remotely, be sure you don't need it anymore before running this!

@astrofrog
astrofrog / qsub.py
Created May 2, 2013 11:39
Submitting jobs via qsub in Python
import os
import random
import string
import tempfile
import subprocess
def random_id(length=8):
return ''.join(random.sample(string.ascii_letters + string.digits, length))
TEMPLATE_SERIAL = """