Skip to content

Instantly share code, notes, and snippets.

View passos's full-sized avatar

Jinyu Liu passos

View GitHub Profile
@passos
passos / pdfcompress.sh
Created February 19, 2024 16:54
compress by ghostscript
inputFile=$1
outputFile=$(echo $inputFile | sed 's|\.pdf$|\.c\.pdf|ig')
echo " input is $inputFile, \noutput is $outputFile"
while true; do
# Prompt the user
read -p "Do you want to continue? (Y/N): " answer
# Convert the input to lowercase
@passos
passos / Dumper.py
Last active March 24, 2023 02:55
A perl Data.Dumper clone for Python
"""
A perl Data.Dumper clone for Python
Author: simon@log4think.com
2011-07-08
Copyright 2011 Jinyu LIU
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
@passos
passos / sublime.keybind
Last active October 28, 2022 22:57
Sublime Keybinding
[
{
"keys": [ "super+f12" ],
"command": "unquote"
},
{
"keys": [ "home" ],
"command": "move_to",
"args": { "to": "bol" }
},
@passos
passos / Stream.java
Last active October 20, 2022 07:33
A very simple stream class for Java 8
package com.example.android.utils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@passos
passos / find_alias
Last active July 12, 2022 22:41
aliases for find some in code
alias ll='ls -GlA'
alias la='ls -GlA'
alias findall=' find . -type f -not -path '\''*/\.*/*'\'' -a -not -path '\''*/node_modules/*'\'' -a -not -path '\''*/build/*'\'' -a -not -path '\''*/lib/*'\'' -print0 | xargs -0 grep --color=auto'
alias findpy=' find . -type f -not -path '\''*/\.*/*'\'' -a -not -path '\''*/node_modules/*'\'' -a -not -path '\''*/build/*'\'' -a -not -path '\''*/lib/*'\'' -a \( -name '\''*.py'\'' -or -name '\''*.templ'\'' \) -print0 | xargs -0 grep --color=auto'
alias findjs=' find . -type f -not -path '\''*/\.*/*'\'' -a -not -path '\''*/node_modules/*'\'' -a -not -path '\''*/build/*'\'' -a -not -path '\''*/lib/*'\'' -name '\''*.js'\'' -print0 | xargs -0 grep --color=auto'
alias findc=' find . -type f -not -path '\''*/\.*/*'\'' -a -not
@passos
passos / AllGattCharacteristics.java
Created January 11, 2022 08:58 — forked from sam016/AllGattCharacteristics.java
Bluetooth GATT Services & Characteristics
package com.sam016.vsflatomation.service.ble;
import java.util.HashMap;
import java.util.UUID;
public class AllGattCharacteristics {
private static HashMap<String, String> attributes = new HashMap();
static {
attributes.put("00002a00-0000-1000-8000-00805f9b34fb", "Device Name");
@passos
passos / DBUtils.pm
Created October 28, 2014 10:17
DBUtils for Perl
package DBUtils;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = @EXPORT_OK = qw(
prepare_stat
exec_sql
exec_stat
query_data
@passos
passos / .gitlab-ci.yml
Last active October 14, 2020 23:53
An Android project CI/CD configuration file for GitLab pipeline. it's updated to the latest Google official Android SDK cmdline-tools package
# Notice:
# GOOGLE_SERVICE_JSON, KEY_STORE_PROP, and STORE_FILE are the variants you can configure in
# project settings so that you can avoid to expose it in project codebase.
# The content of these variants are in Base64 format.
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "28"
ANDROID_BUILD_TOOLS: "28.0.3"
@passos
passos / filter.txt
Last active September 13, 2020 18:43
|http://pc.zmzapi.com/pc_html/pages
|http://pc.zmzapi.com/*a=ad_list|
@passos
passos / Binary Indexed Tree.py
Created March 12, 2020 02:50 — forked from rajatdiptabiswas/Binary Indexed Tree.py
Implementation of Binary Indexed Tree/Fenwick Tree in Python
#!/usr/bin/env python3
"""
Binary Indexed Tree / Fenwick Tree
https://www.hackerearth.com/practice/notes/binary-indexed-tree-made-easy-2/
https://www.topcoder.com/community/data-science/data-science-tutorials/binary-indexed-trees/
https://www.youtube.com/watch?v=v_wj_mOAlig
https://www.youtube.com/watch?v=kPaJfAUwViY
"""