Skip to content

Instantly share code, notes, and snippets.

View unkcpz's full-sized avatar

Jusong Yu unkcpz

  • Swiss
View GitHub Profile
<UPF version="2.0.1">
<PP_INFO>
Generated using Vanderbilt code, version 7 3 6
Author: kfg Generation date: 31 3 15
Automatically converted from original format
1 The Pseudo was generated with a Scalar-Relativistic Calculation
2.23000000000E+00 Local Potential cutoff radius
nl pn l occ Rcut Rcut US E pseu
4P 4 1 6.00 0.00000000000 1.53000000000 -4.15068716400
4D 4 2 9.50 0.00000000000 1.63000000000 -0.66209811300
@unkcpz
unkcpz / aiida-with-pg-rmq-containers.md
Created December 2, 2021 12:57 — forked from ltalirz/aiida-with-pg-rmq-containers.md
AiiDA production setup with containerized Postgresql & Rabbitmq

Why?

As of May 4th, 2021, erlang is not available from macports for the ARM (Apple Silicon) platform. Docker containers make it super easy to install postgresql and rabbitmq.

The M1 chips have great parallelism, so I'd hope to be able to run docker without noticing the overhead too much. I could use conda as well, but docker provides the neat docker-compose.yaml that makes it possible to start up and shut down all the services required with a single command.

Task

@unkcpz
unkcpz / test-leak-daemon.py
Created December 25, 2020 11:59
script which reproduce the memory leak issue
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# #
# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core #
# For further information on the license, see the LICENSE.txt file #
# For further information please visit http://www.aiida.net #
###########################################################################
# pylint: disable=no-name-in-module
@unkcpz
unkcpz / patch.diff
Last active August 20, 2020 09:49
This is the diff patch of Dockerfile of aiidalab depoly in China domestic
diff --git a/Dockerfile b/Dockerfile
index 433c334..fcb1d09 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -38,12 +38,17 @@ RUN /usr/bin/pip3 install \
# TODO, remove when https://github.com/aiidateam/aiida-sssp/pull/25 is merged
# and installed on AiiDA lab
WORKDIR /opt/pseudos
-RUN base_url=http://legacy-archive.materialscloud.org/file/2018.0001/v3; \
-wget ${base_url}/SSSP_efficiency_pseudos.aiida; \
@unkcpz
unkcpz / process_run.py
Created May 7, 2020 08:30
In the context of asyncio, which way is better in running the process and interacting with it.
@pytest.mark.asyncio
async def test_wait_pause_play_resume():
"""
Test that if you pause a process that and its awaitable finishes that it
completes correctly when played again.
"""
proc = utils.WaitForSignalProcess()
asyncio.ensure_future(proc.step_until_terminated())
await utils.run_until_waiting(proc)
import numpy as np
import matplotlib.pyplot as plt
# fitting equation: y = (a-d)/(1+(x/c)^b)+d
# genrate the data set
a,b,c,d = 1,2,3,4
x = np.arange(0,10,0.01)
y = (a-d)/(1+(x/c)**b)+d + 0.1*np.random.random(len(x))
@unkcpz
unkcpz / startup.jl
Created May 30, 2019 05:10
julia startup.jl
ENV["EDITOR"] = "atom"
const PLOTS_DEFAULTS = Dict(:theme => :wong)
try
@eval using Revise
# Turn on Revise's automatic-evaluation behavior
Revise.async_steal_repl_backend()
@eval using Rebugger
# Activate Rebugger's key bindings
@unkcpz
unkcpz / logistic4p.cpp
Last active May 19, 2019 06:40
logistic
// The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
/*
This is an example illustrating the use the general purpose non-linear
least squares optimization routines from the dlib C++ Library.
This example program will demonstrate how these routines can be used for data fitting.
In particular, we will generate a set of data and then use the least squares
routines to infer the parameters of the model which generated the data.
*/
@unkcpz
unkcpz / release.sh
Last active April 13, 2019 04:27
A shell script auto tag version and merge and release by git. 分支的发布
PACKAGE="kiwipy"
VERSION_FILE=${PACKAGE}/version.py
version=$1
while true; do
read -p "Release version ${version}? " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
@unkcpz
unkcpz / timeout_and_tick.go
Created April 3, 2019 01:34 — forked from ngauthier/timeout_and_tick.go
Golang timeout and tick loop
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout: