Skip to content

Instantly share code, notes, and snippets.

View amarao's full-sized avatar
⌨️
Pushing buttons hard enough to get paid

George Shuklin amarao

⌨️
Pushing buttons hard enough to get paid
  • Servers.com
  • Limassol, Cyprus
View GitHub Profile
Host gate
Hostname gate.foo.bar
host real
Hostname real.host.to.connect
User user
ProxyCommand ssh -W %h:%p gate
RequestTTY yes
#!/bin/bash
#modprobe pktgen
modprobe pktgen
function pgset() {
local result
echo $1 > $PGDEV
#!/usr/bin/python
import nagiosplugin
class Mycheck(nagiosplugin.Resource):
def __init__(self, url):
self.check_operations=["check1", "check2", "check3"]
self.url=url
---
- name: test hostvars host1
hosts: LBL
tasks:
- shell: echo `hostname`
register: ls_out
- set_fact:
ls_down: '{{ ls_out.stdout }}'
- name: test hostvars
<opml version="1.1">
<body><outline text="YouTube Subscriptions" title="YouTube Subscriptions"><outline text="Ichiban Moto" title="Ichiban Moto" type="rss" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=UC28gtkJP-bK77M5Qyc3Dn7g" /><outline text="#Chemistry" title="#Chemistry" type="rss" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=UChyplgK6jTl_XySEv0znTJw" /><outline text="The Royal Institution" title="The Royal Institution" type="rss" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=UCYeF244yNGuFefuFKqxIAXw" /><outline text="FlinnScientific" title="FlinnScientific" type="rss" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=UCyGYwaz6D8NzrfDRDIVmMnQ" /><outline text="PBS Space Time" title="PBS Space Time" type="rss" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=UC7_gcs09iThXybpVgjHZ_7g" /><outline text="New Masters Academy" title="New Masters Academy" type="rss" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=UCliUF1c8m7MUspaCykJljSg"
#!/usr/bin/python
def myfunc(arg1, arg2):
return arg1 + arg2
print "result": myfunc(1, 2)
myfunc(3, 4) # no result, but calling anyway.
@amarao
amarao / sparse_dump.py
Created April 14, 2016 12:59
Dump all holes in sparse file
#!/usr/bin/python3
import os
import sys
if len(sys.argv) < 2:
print ("Usage: sparse_dump filename")
sys.exit(-1)
fd = os.open(sys.argv[1], os.O_RDONLY)
end = os.lseek(fd, 0, os.SEEK_END)
offset = 0
cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
0: 23 0 0 0 IR-IO-APIC 2-edge timer
1: 14967 1 0 0 IR-IO-APIC 1-edge i8042
8: 1 0 0 0 IR-IO-APIC 8-edge rtc0
9: 45129 3132 0 0 IR-IO-APIC 9-fasteoi acpi
12: 1653796 392 0 0 IR-IO-APIC 12-edge i8042
16: 890 0 0 0 IR-IO-APIC 16-fasteoi ehci_hcd:usb1, mmc0
19: 10 3 0 0 IR-IO-APIC 19-fasteoi
23: 223427 116657 115994 0 IR-IO-APIC 23-fasteoi ehci_hcd:usb2
@amarao
amarao / ceph osd debug log
Created June 17, 2016 12:33
debug log from ceph OSD (please ignore if you googled to this)
# /usr/bin/ceph-osd -d --cluster ceph --id 6 --setuser ceph --setgroup ceph
2016-06-17 12:31:31.111497 7f22c776e8c0 0 set uid:gid to 64045:64045 (ceph:ceph)
2016-06-17 12:31:31.111512 7f22c776e8c0 0 ceph version 10.2.0 (3a9fba20ec743699b69bd0181dd6c54dc01c64b9), process ceph-osd, pid 3595
2016-06-17 12:31:31.111534 7f22c776e8c0 5 object store type is filestore
starting osd.6 at :/0 osd_data /var/lib/ceph/osd/ceph-6 /var/lib/ceph/osd/ceph-6/journal
2016-06-17 12:31:31.111941 7f22c776e8c0 1 accepter.accepter.bind my_inst.addr is 0.0.0.0:6800/3595 need_addr=1
2016-06-17 12:31:31.111957 7f22c776e8c0 1 accepter.accepter.bind my_inst.addr is 0.0.0.0:6801/3595 need_addr=1
2016-06-17 12:31:31.111964 7f22c776e8c0 1 accepter.accepter.bind my_inst.addr is 0.0.0.0:6802/3595 need_addr=1
2016-06-17 12:31:31.111976 7f22c776e8c0 1 accepter.accepter.bind my_inst.addr is 0.0.0.0:6803/3595 need_addr=1
/sys
├── block
│   ├── nbd0 -> ../devices/virtual/block/nbd0
│   ├── nbd1 -> ../devices/virtual/block/nbd1
│   ├── nbd10 -> ../devices/virtual/block/nbd10
│   ├── nbd11 -> ../devices/virtual/block/nbd11
│   ├── nbd12 -> ../devices/virtual/block/nbd12
│   ├── nbd13 -> ../devices/virtual/block/nbd13
│   ├── nbd14 -> ../devices/virtual/block/nbd14
│   ├── nbd15 -> ../devices/virtual/block/nbd15