Skip to content

Instantly share code, notes, and snippets.

View neoatlantis's full-sized avatar

NeoAtlantis neoatlantis

View GitHub Profile
@neoatlantis
neoatlantis / .vimrc
Created February 28, 2022 21:34
My vimrc
set encoding=utf8
set langmenu=zh_CN.UTF-8
set imcmdline
color darkspectrum
syntax on
set softtabstop=4 shiftwidth=4 expandtab autoindent
set nu
@neoatlantis
neoatlantis / modify-file-by-line.py
Created July 12, 2019 12:26
按照自定义的要求修改一个文本文件。给朋友的例子。
#!/usr/bin/env python3
def modify_line(original, lineid):
"""在本函数下面定义要进行的修改
如果不需要作出修改应当直接退出函数如果需要作出修改让函数返回一个
字符串使用 lineid 得知需要处理哪一行lineid 不将空行计算在内
范例
修改第一行在第三个字符后面加上逗号
@neoatlantis
neoatlantis / multivar_newton.py
Created January 12, 2019 23:39
Newton iteration for multiple variablew
#!/usr/bin/env python3
import numpy
from numpy.linalg import inv
def newton_multi(func, x0, etol=1e-3, dx=1):
f0 = func(x0)
n = len(f0)
if n != len(x0):
raise Exception("func() must return a vector of same length as x0")
@neoatlantis
neoatlantis / output.txt
Last active November 8, 2018 21:08
Ants on a rod walking...
22 48
----------------------------------------------------------------
0 -1---2---3------4----5-----
1 1---2---3------4----5------
2 ---2---3------4----5-------
3 --2---3------4----5--------
4 -2---3------4----5---------
5 2---3------4----5----------
6 ---3------4----5-----------
7 --3------4----5------------
#!/usr/bin/env python3
import itertools
A, B, C, D = [1, 2, 3, 4]
iterer = itertools.product([A, B, C, D], repeat=10)
for comb in iterer:
@neoatlantis
neoatlantis / port-forwarding.py
Last active October 3, 2020 02:38 — forked from WangYihang/port-forwarding.py
port forwarding via python socket
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# TCP Port Forwarding via Socks5 Socket
# Original Author : WangYihang <[email protected]> (for port forwarding)
# (As gist: <https://gist.github.com/WangYihang/e7d36b744557e4673d2157499f6c6b5e>)
# Changes : NeoAtlantis <[email protected]>
# (adapted to pySocks, argparse for CLI invokation, encryption, etc.)
import argparse
@neoatlantis
neoatlantis / neoatlantis_twitter_blacklist.csv
Last active August 7, 2017 03:11
我的推特屏蔽名单
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
886026925768146945
885692130357780482
882477377917300736
807809285874806784
890060954620358657
886423426654552064
856065719712096256
876240699053580288
855034219352907776
810486731174621184

Keybase proof

I hereby claim:

  • I am neoatlantis on github.
  • I am neoatlantis (https://keybase.io/neoatlantis) on keybase.
  • I have a public key whose fingerprint is FD21 310C 602C E194 15B5 6F71 1D08 AF5B 7B3E 8DB9

To claim this, I am signing this object:

#include <stdio.h>
struct Date{
int year;
int month;
int day;
};
int dateDiff(struct Date, struct Date);
int yearDays(int);