Skip to content

Instantly share code, notes, and snippets.

from io import BytesIO
from petrel_client.client import Client
from nibabel import FileHolder, Nifti1Image
from gzip import GzipFile
import numpy as np
# url 就是 s3:// 路径
def open_npy(url):
conf_path = '~/petreloss.conf'
@mustafabutt-dev
mustafabutt-dev / chatgpt-and-google-docs.gs
Created February 3, 2023 22:04
Google Docs Integration with ChatGPT
// DROP DOWN MENU
function onOpen() {
DocumentApp.getUi().createMenu("ChatGPT")
.addItem("Generate Image", "generateImage")
.addItem("Generate synonym ", "generateSynonym")
.addItem("Write a tagline", "tagLine")
.addToUi();
}
// ****END MENU****
@wojteklu
wojteklu / clean_code.md
Last active May 10, 2024 13:02
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@MikuroXina
MikuroXina / endless-error-loop.py
Created December 26, 2022 15:50
Lyrics of "Endless Error Loop" by Neko Hacker feat. ななひら.
print('''<header>
ここをもうちょっとシンプルに変えてっと
え、なにこのエラー・・・
</header>''')
try:
uglyCode()
except:
print('よくあるError')
try:
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 10, 2024 12:56
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@0xjac
0xjac / private_fork.md
Last active May 10, 2024 12:56
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@Jackarain
Jackarain / gist:ecc6594ef6930db7fa7f
Created March 23, 2015 04:50
Linking libstdc++ statically
Linking libstdc++ statically
Christopher Baus writes about his problems linking libstdc++ statically. Yes, making C++ binaries that will work properly in different Linux distributions is somewhat painful. The problem is not so much linking libstdc++ statically – it is just a library, after all – but the runtime support required by C++ code in general, to enable features like RTTI and exception handling.
The runtime support code used by different parts of a C++ application needs to be compatible. If one part of the program needs to dynamic_cast or catch objects provided by another, both parts must agree on certain implementation details: how to find vtables, how to unwind the stack, and so on.
For C++ and a few other GCC-supported languages with similar features, such details are specified by a C++ ABI. Whenever the ABI used by GCC changes you'll end up with incompatible libraries produced by the different GCC versions. The same is true for plain C, but the C ABI is much simpler and has been around a lot lon
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 10, 2024 12:58
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy

Building Python 3.11

This article focuses on building CPython for common Linux server operating systems.

These scripts will be tested in fresh Docker container.

I'll install dependencies from package manager if possible, or I'll try compile myself if that makes sense.

The dependencies doesn't change much between these CPython versions, so Python 3.12 and 3.10