Skip to content

Instantly share code, notes, and snippets.

Simon/Jinyu Liu passos

View GitHub Profile
@passos
passos / Binary Indexed Tree.py
Created Mar 12, 2020 — forked from rajatdiptabiswas/Binary Indexed Tree.py
Implementation of Binary Indexed Tree/Fenwick Tree in Python
View Binary Indexed Tree.py
#!/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
"""
@passos
passos / sublime.keybind
Created Aug 17, 2017
Sublime Keybinding
View sublime.keybind
[
{
"keys": ["super+f12"], "command": "unquote"
},
{
"keys": [
"home"
],
"command": "move_to",
@passos
passos / .scala
Last active Jul 19, 2017
scala play WSRequest standalone script
View .scala
/*
create `build.sbt` and add following content
```
scalaVersion := "2.11.1"
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies += "com.typesafe.play" %% "play" % "2.5.12"
libraryDependencies += "com.typesafe.play" % "play-ws_2.11" % "2.5.12"
```
@passos
passos / find_alias
Created Jul 17, 2017
aliases for find some in code
View find_alias
alias findall='find . -type f -not -path '\''*/.git/*'\'' -a -not -path '\''*/.svn/*'\'' -print0 | xargs -0 grep --color=auto'
alias findc='find . -type f -not -path '\''*/.git/*'\'' -a -not -path '\''*/.svn/*'\'' -a \( -name '\''*.c'\'' -or -name '\''*.h'\'' -or -name '\''*.cpp'\'' -or -name '\''*.cxx'\'' \) -print0 | xargs -0 grep --color=auto'
alias findgradle='find . -type f -not -path '\''*/.git/*'\'' -a -not -path '\''*/.svn/*'\'' -a -not -path '\''*/lib/*'\'' -a -name '\''*.gradle'\'' -print0 | xargs -0 grep --color=auto'
alias findjava='find . -type f -not -path '\''*/.git/*'\'' -a -not -path '\''*/.svn/*'\'' -a -not -path '\''*/build/*'\'' -name '\''*.java'\'' -print0 | xargs -0 grep --color=auto'
alias findjs='find . -type f -not -path '\''*/.git/*'\'' -a -not -path '\''*/.svn/*'\'' -a -not -path '\''*/build/*'\'' -name '\''*.js'\'' -print0 | xargs -0 grep --color=auto'
alias findjx='find . -type f -not -path '\''*/.git/*'\'' -a -not -path '\''*/.svn/*'\'' -a -not -path '\''*/build/*'\'' -a \( -name
View L1.c
#include <stdio.h>
#include <stdlib.h>
#include <String.h>
#define MAX_LINE_NUM 1000
#define MAX_COLUMN_NUM 30
#define MAX_RECORD_LENGTH 51
#define IDENT_LENGTH 4
void readFile(char A[MAX_LINE_NUM][MAX_COLUMN_NUM][MAX_RECORD_LENGTH], int *numOfLine, int *numOfCol);
View gist:609403deb2a6f9481c2fb703d93666ca
APK is pulled from Nexus6p and dumped with `aapt dump permissions base.apk`
package: com.eg.android.AlipayGphone
uses-permission: name='com.alipay.permission.ALIPAY_UPDATE_CREDENTIALS'
uses-permission: name='com.android.launcher.permission.INSTALL_SHORTCUT'
uses-permission: name='android.permission.BLUETOOTH'
uses-permission: name='android.permission.CHANGE_WIFI_STATE'
uses-permission: name='android.permission.CAMERA'
uses-permission: name='android.permission.ACCESS_NETWORK_STATE'
uses-permission: name='android.permission.MODIFY_AUDIO_SETTINGS'
View gist:10471531
#!/usr/bin/python
def solve1(a):
s = [0] * len(a)
for i in range(len(a) - 1):
s[i] = a[i + 1] - a[i]
mx = s[0]
@passos
passos / a.com
Created May 26, 2012
deassemble code "B311 F6E3 B30A F6F3 8AC4"
View a.com
D:\>DEBUG A.COM
-U
13FB:0100 B100 MOV CL,00
13FB:0102 88C8 MOV AL,CL
13FB:0104 B311 MOV BL,11
13FB:0106 F6E3 MUL BL
13FB:0108 B30A MOV BL,0A
13FB:010A F6F3 DIV BL
13FB:010C 8AC4 MOV AL,AH
13FB:010E 88C2 MOV DL,AL
@passos
passos / remove_multiple_space.c
Created Mar 29, 2012
Remove multiple spaces, answers gist.github.com/2227226
View remove_multiple_space.c
#include <stdio.h>
int removeMultipleSpace(char baseStr[])
{
char *p = baseStr;
char *t = baseStr;
while ( *p ) {
if ( *p == ' ' ) {
*t++ = *p++;
@passos
passos / remove_multiple_space.c
Created Mar 29, 2012
Remove continuous spaces, answers gist.github.com/2227226
View remove_multiple_space.c
#include <stdio.h>
int removeMultipleSpace(char baseStr[])
{
char *p = baseStr;
char *t = baseStr;
while ( *p ) {
if ( *p == ' ' ) {
*t++ = *p++;
You can’t perform that action at this time.