Skip to content

Instantly share code, notes, and snippets.

View piotr-piatkowski's full-sized avatar

Piotr Piatkowski piotr-piatkowski

View GitHub Profile
root@st3:/proc/31633# cat /proc/meminfo
MemTotal: 24690512 kB
MemFree: 539752 kB
MemAvailable: 1027724 kB
Buffers: 74160 kB
Cached: 19504260 kB
SwapCached: 0 kB
Active: 3961504 kB
Inactive: 19339012 kB
Active(anon): 3734376 kB
00400000-0082b000 r-xp 00000000 fc:00 1716300 /usr/bin/searchd
00a2a000-00a2b000 r--p 0042a000 fc:00 1716300 /usr/bin/searchd
00a2b000-00a33000 rw-p 0042b000 fc:00 1716300 /usr/bin/searchd
00a33000-00a40000 rw-p 00000000 00:00 0
02761000-04714000 rw-p 00000000 00:00 0 [heap]
7f77be559000-7f77bf3dc000 rw-s 00000000 00:05 226868579 /dev/zero (deleted)
7f77bf3dc000-7f77c038d000 rw-s 00000000 00:05 226694153 /dev/zero (deleted)
7f77c038d000-7f77c13d5000 rw-s 00000000 00:05 226525765 /dev/zero (deleted)
7f77c13d5000-7f77c25ac000 rw-s 00000000 00:05 226366677 /dev/zero (deleted)
7f77c25ac000-7f77c3919000 rw-s 00000000 00:05 226205742 /dev/zero (deleted)
#!/usr/bin/env python
# coding: utf-8
from influxdb import InfluxDBClient
import time
DBNAME = 'test_db'
SERIES_NAME = 'test_series'
POINTS_NUMBER = 5000000
THRESHOLD = 500000
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/kompas/.ssh/config
debug1: /home/kompas/.ssh/config line 39: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to bamboo16.lzil.la [25.51.23.16] port 22.
debug1: Connection established.
debug1: identity file /home/kompas/.ssh/id_rsa type 1
debug1: identity file /home/kompas/.ssh/id_rsa-cert type -1
>>> class Node(object):
... def __init__(self, n): self.name = n
... def getName(self): return self.name
...
>>> n = Node('abc')
>>> n.getName()
'abc'
>>> node('xyz')
<__main__.Node object at 0x7f7dbc033f50>
>>> def node(name): return Node(name)
import RPi.GPIO as GPIO
import time
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('')
logger.setLevel(logging.DEBUG)
#!/usr/bin/env python
# my_first_calculator.py by AceLewis
# optimized by Kompas
if 3/2 == 1: # Because Python 2 does not know maths
input = raw_input # Python 2 compatibility
print('Welcome to this calculator!')
print('It can add, subtract, multiply and divide whole numbers from 0 to 50')
num1 = float(input('Please choose your first number: '))
def get_by_keys(res, *keys):
try:
for k in keys:
res = res[k]
return res
except (TypeError, KeyError, IndexError):
return None
book_data = {
'title': get_by_keys(result, 'volumeInfo', 'title'),
#!/usr/bin/python3
import json
import requests
def get_by_keys(res, *keys):
try:
for k in keys:
res = res[k]
return res
long next_state_change = 0;
long state = -1;
void loop() {
if(digitalRead(PIN_BUTTON) == LOW) {
state = 5;
// it will start counting after releasing button
next_state_change = millis() + 10000;