Skip to content

Instantly share code, notes, and snippets.

@dallaslu
dallaslu / non_leaf_account_alias.py
Created October 28, 2021 03:24
beancount plugin
"""add non-leaf accounts a alias
Case:
* If you open a account `Expenses:Food:Dinner`, and then add a posting with `Expenses:Food`
* If you open a account `Expenses:Food` and `Expense:Food:Dinner`, and get incomprehensible balance in fava
Example 1:
2021-10-01 open Assets:Cash
2021-10-01 open Expenses:Food:Dinner
2021-10-01 open Expenses:Food:Blah
@dallaslu
dallaslu / sort_by_time.py
Created October 20, 2021 04:07
Sort Beancount Entries by meta['time']
"""Sort Beancount Entries by meta['time']
Although beancount says that time is meaningless, there are situations
where an account that should not be negative may have a negative balance
at some point because transfers that occurred on the same day are
scheduled later and spending records are scheduled earlier.
This is not a big deal, but it is a bit odd.
2021-10-01 balance Assets:Cash 500 USD

Keybase proof

I hereby claim:

  • I am dallaslu on github.
  • I am dallaslu (https://keybase.io/dallaslu) on keybase.
  • I have a public key whose fingerprint is 8BBD B932 BBB1 8681 F633 2552 4061 F9D8 AA6F 7DC5

To claim this, I am signing this object:

package com.v2ex.utils;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class DuplicateElementUtils{
public static <T> List<T> getDuplicateElements(List<T> list){
List<T> result = new ArrayList<T>();
@dallaslu
dallaslu / surge_main.conf
Created October 27, 2015 00:49 — forked from jason5ng32/surge.conf
Surge Configs ( Both 2 files are needed )
[General]
loglevel = notify
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24,100.64.0.0/10
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24,100.64.0.0/10
// DNS OVERRIDE, REMOVE # IF YOU NEED
# dns-server = 223.6.6.6,223.5.5.5,114.114.114.114,114.114.115.115
[Rule]
public static void main(String[] args) throws Exception {
Class<?> cache = Class.forName("java.lang.Integer$IntegerCache");
Field field = cache.getDeclaredField("cache");
field.setAccessible(true);
Object value = field.get(null);
Array.set(value, 130, 3);
Integer result = 1 + 1;
System.out.println("1 + 1 = " + result);
}
require.config({
paths: {
"jquery": "../jquery/2.1.1/jquery.min.js"
}
}); // require 框架
(function($){
window.alert = function( msg ){
$('#message').append( msg );
$tag_name = str_replace("refs/tags/","",$json->ref);
$argsment = $tag_name;
if( !empty($json->repository)){
$work_path = $json->repository->git_ssh_url;
$work_path = explode(":", $work_path);
$work_path = explode(".", $work_path[1]);
log_append('work_path: ' . $work_path[0]);
$argsment .= ' ' . $work_path[0];
#!bin/sh
git_foler=~/workspace/$2
if [ ! -d "$git_foler" ]; then
mkdir -p "$git_foler"
echo "cd" $git_foler
group_folder=`dirname $git_foler`
cd $group_folder
echo "git clone" git@192.168.1.4:$2.git
#!bin/sh
# $1 tag name
# $2 work path
ssh package@127.0.0.1 "sh ~/package.sh $1 $2 > /dev/null 2>&1" << EOC
exit
EOC
echo done!