Skip to content

Instantly share code, notes, and snippets.

View ficoos's full-sized avatar

Saggi Mizrahi ficoos

  • Huawei Co. LTD.
View GitHub Profile
@ficoos
ficoos / per.py
Created March 21, 2019 14:10
Multiplication persistance
def per(n, print_steps=False):
steps = 0
while n >= 10:
sum = 1
while n > 0:
sum *= n % 10
n //= 10
n = sum
steps += 1
@ficoos
ficoos / combo.py
Last active August 23, 2021 01:54
Simple combo handling code
# simple combo handling code
import collections
# priority is just a number used to decide
# what move was made when more than 1
# move is validated by the same input.
PriorityLow = 99
PriorityHigh = 1
@ficoos
ficoos / hsm.py
Last active December 23, 2015 15:49
@classmethod
def isPoolConnected(spUUID):
return spUUID in cls.pools
def _checkDomainPoolRelationship(self, domainInfo):
"""Performs sanity checks about dmoain<->pool relationship
Returns true if all checks succeeded or false if they didn't
"""
rolse = info['role']
typedef int(*BuffOp)(char* buffer, void* ctx);
struct OpNode {
BuffOp op;
struct OpNode *next;
void* ctx;
};
int call_chain(struct OpNode* node, char* buffer) {
int rv;