Skip to content

Instantly share code, notes, and snippets.

View monester's full-sized avatar
🎯
Focusing

Alexander Charykov monester

🎯
Focusing
  • Moscow
View GitHub Profile
@monester
monester / diff_merge.py
Last active August 29, 2015 14:23
Functions to create increment dict from old and new dict
def diff(new, old):
""" Return diff of elements
:param new:
:param old:
:return:
same: bool (if compared values the same)
value: dict || list || value (depends on income object)
"""
if type(new) != type(old):
return new
import requests
import lxml.etree as etree
def pp(url):
responce = requests.get(url, auth=auth)
if responce.status_code == 200:
content = responce.content
print etree.tostring(etree.fromstring(content), pretty_print = True)
else:
print "Invalid responce, code=%s, url=%s" % (responce.status_code, url)
@monester
monester / supermicro-ipmi-mac-address.md
Created August 17, 2016 17:46 — forked from DavidWittman/supermicro-ipmi-mac-address.md
Pull the LAN1/eth0 MAC address from SuperMicro IPMI

You can find the MAC address for LAN1/eth0 (not the BMC MAC) via the SuperMicro IPMI interface by running the following command:

$ ipmitool -U <redacted> -P <redacted> -H 10.4.0.10 raw 0x30 0x21 | tail -c 18
00 25 90 f0 be ef
films = [
(1998, 2008), # The presidents
(1999, 2005), # Descrite math
(2001, 2009), # Tarjan
(2005, 2009), # Halting
(2007, 2011), # Steiner
(2010, 2020), # the four volume
(2012, 2018), # programming chall
(2014, 2022), # process term
(2018, 2020), # calculated bets
f = open("replay_last_battle.wotreplay", 'rb')
data = f.read()
magic_number, data = data[:4], data[4:]
block_count, data = int.from_bytes(data[:4], byteorder='little'), data[4:]
blocks = []
for block_id in range(block_count):
block_length, data = int.from_bytes(data[:4], byteorder='little'), data[4:]
#!/bin/sh
# usage: tailnew < /var/log/messages
awk 'BEGIN{getline l<"/tmp/tailnew"}(NR>l){print;l=NR}END{print l>"/tmp/tailnew"}'
#!/bin/bash
set -x
set -e
if [[ $(id -u) != 0 ]]; then
sudo $(realpath $0) $@
exit
fi
@monester
monester / install-docker-ce-ubuntu.sh
Created June 10, 2018 13:01
install-docker-ce-ubuntu.sh
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
# ruamel.yaml adds !!omap when using ordered dicts
# and there is no switch to avoid such behaviour
# Here is a workarond to put all keys in specific order
# and instead of following constuctions:
# list:
# - !!omap
# - [key1, value1]
# - [key2, value2]
# create this one:
# list:
# create service-principal
az ad sp create-for-rbac --query "{ client_id: appId, client_secret: password, tenant_id: tenant }"
cat >~/.azure/credentials <<EOF
# az ad sp create-for-rbac --query "{ client_id: appId, client_secret: password, tenant_id: tenant }"
[default]
# subscription
subscription_id=