Skip to content

Instantly share code, notes, and snippets.

Avatar

Dallas Lu dallaslu

View GitHub Profile
View gitlab-webhook-push.sh
#!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!
View package.sh
#!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
View gitlab-webhook-push.php
$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];
View example.js
require.config({
paths: {
"jquery": "../jquery/2.1.1/jquery.min.js"
}
}); // require 框架
(function($){
window.alert = function( msg ){
$('#message').append( msg );
View Test.java
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);
}
@dallaslu
dallaslu / surge_main.conf
Created Oct 27, 2015 — forked from jason5ng32/surge.conf
Surge Configs ( Both 2 files are needed )
View surge_main.conf
[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]
View DuplicateElementUtils.java
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>();
View keybase.md

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:

@dallaslu
dallaslu / sort_by_time.py
Created Oct 20, 2021
Sort Beancount Entries by meta['time']
View sort_by_time.py
"""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
View non_leaf_account_alias.py
"""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