Skip to content

Instantly share code, notes, and snippets.

View weijianwen's full-sized avatar

Jianwen weijianwen

  • HPC Center of Shanghai Jiao Tong University
  • Shanghai, China
View GitHub Profile
@weijianwen
weijianwen / utc_the_right_way.py
Created September 19, 2014 11:09
Demonstrate how to get UTC seconds for a local time in Python, in both the right and wrong way.
from datetime import datetime
from pytz import timezone
dt = timezone("Asia/Shanghai").localize(datetime(1970, 1, 1, 8, 0, 0, 0))
UTC_EPOCH = datetime(1970, 1, 1, 0, 0, 0, 0, tzinfo=timezone("UTC"))
print int((dt - UTC_EPOCH).total_seconds())
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
# @see http://bit.ly/UmpwkV/
# @author Antony Stubbs
# set the internal field separator to line break,
# so that we can iterate easily over the verify-pack output
@weijianwen
weijianwen / public_access
Last active August 29, 2015 14:16
S3 policy to make a bucket public accessible
{
"Version": "2008-10-17",
"Id": "UNIQUE_POLICY_NUM",
"Statement": [
{
"Sid": "UNIQUE_SID",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your_bucket/*"
squeue --state=running --format="%.16u %C" | grep -v CPUS | awk '{sum += $2} END {print sum}'
squeue --state=running --format="%.16u %C" | grep -v CPUS | sort | awk '{sum[$1] += $2} END {for (i in sum) print i, sum[i]}' | sort -nk2
squeue --state=running --format="%.16u %C" | grep -v CPUS | awk '{sum += $2} END {print sum}'
squeue --state=running --format="%.16u %C" | grep -v CPUS | sort | awk '{sum[$1] += $2} END {for (i in sum) print i, sum[i]}' | sort -nk2

slurm.conf

修正明显配置错误

建议修正当前slurm.conf的一些和常规用法差别较大的配置,建议逐步尝试把这些用法修正。这些配置修改对SLURM用法没有影响,可以在线进行。若发生异常,还原slurm.conf配置,重启slurm服务即可。

更正节点列表写法

@weijianwen
weijianwen / sjtupi2_config.py
Last active July 24, 2020 10:47
XALT2 configuration for SJTU Pi^2 Supercomputer
# This is the config file for specifying tables necessary to configure XALT:
# The patterns listed here are the hosts that can track executable with XALT.
# Typical usage is that compute nodes track executable with XALT while login
# nodes do not.
import sys
# Note that linking an executable is everywhere and is independent of
# hostname_patterns
@weijianwen
weijianwen / default.custom.yaml
Last active January 21, 2024 03:23 — forked from lewangdev/default.custom.yaml
雾凇拼音自定义配置,MacOS-like & Wechat-like Dark/Light Color Scheme For Rime
patch:
# 菜单
menu:
page_size: 8 # 候选词个数
# alternative_select_labels: [ ①, ②, ③, ④, ⑤, ⑥, ⑦, ⑧, ⑨, ⑩ ] # 修改候选项标签
# alternative_select_keys: ASDFGHJKL # 如编码字符占用数字键,则需另设选字键
# ascii_mode、inline、no_inline、vim_mode 等等设定,可参考 /Library/Input Methods/Squirrel.app/Contents/SharedSupport/squirrel.yaml
# 中西文切换
#
# 【good_old_caps_lock】 CapsLock 切换到大写或切换中英。