Skip to content

Instantly share code, notes, and snippets.

View MatheMatrix's full-sized avatar
💭
Studying...

Wei.Wang MatheMatrix

💭
Studying...
View GitHub Profile
@MatheMatrix
MatheMatrix / git-search-commit-message
Created November 7, 2021 06:37 — forked from helhum/git-search-commit-message
Git command to show (remote) branches and tags that contain a commit with a specified commit message
#!/bin/bash
function search-branches() {
for sha1 in `git log --oneline --all --grep "$1" | cut -d" " -f1`
do
git branch -r --contains $sha1
done
}
function search-tags() {
for sha1 in `git log --oneline --all --grep "$1" | cut -d" " -f1`
do
@MatheMatrix
MatheMatrix / opcode.sh
Created November 2, 2021 02:16
opcode
#!/bin/bash
#
# Last update on Nov 05, 2014.
#
# Searches disassembled code for specific instructions.
#
# Opcodes obtained from: https://github.com/Shirk/vim-gas/blob/master/syntax/gas.vim
#
# List of opcodes has been obtained using the following commands and making a few modifications:
# echo '#!/bin/bash' > Opcode_list
@MatheMatrix
MatheMatrix / strace_commit.log.sh
Last active February 9, 2017 03:29
strace commit
This file has been truncated, but you can view the full file.
Thu Feb 9 10:35:08 CST 2017
********************************************************************
execve("/opt/vyatta/sbin/my_commit", ["/opt/vyatta/sbin/my_commit"], [/* 55 vars */]) = 0
brk(0) = 0x2490000
fcntl(0, F_GETFD) = 0
fcntl(1, F_GETFD) = 0
fcntl(2, F_GETFD) = 0
access("/etc/suid-debug", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f51b788e000
#!/usr/bin/env bash
# Assume compute node has singe IP
# Plese confirm your /etc/hosts
LOCALIP=192.168.1.12
HOSTNAME=compute1
# Test installatiom model works
function test()
def get_admin_roles():
"""Return a list of roles which are granted admin rights according
to policy settings.
"""
# NOTE(salvatore-orlando): This function provides a solution for
# populating implicit contexts with the appropriate roles so that
# they correctly pass policy checks, and will become superseded
# once all explicit policy checks are removed from db logic and
# plugin modules. For backward compatibility it returns the literal
# admin if ADMIN_CTX_POLICY is not defined
attr = {'name':'', 'gender':'', 'age':''}
def add_attr(clas):
clas.attr = attr
return clas
@add_attr
class Person(object):
"""docstring for Person"""
# coding: utf-8
import time
import sys
def print_detail(func):
def _print_detail(*args):
print func.__name__
print func.__doc__
print sys.getrefcount(func)
# coding: utf-8
import time
import sys
def print_detail(func):
print func.__name__
print func.__doc__
print sys.getrefcount(func)
start = time.time()
# coding: utf-8
import time
import sys
def print_detail(func):
print func.__name__
print func.__doc__
print sys.getrefcount(func)
start = time.time()