This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 """ mockup language engine for plugins """ | |
import json | |
js = '{"name":"command_name", "prompt": [{"question": "where do you want to ping", "var": "dest"},{"question": "ping from", "var": "src"}], "handler": "some_function", "query": "ping $dest from $src"}' | |
j = json.loads(js) | |
def some_function(j): | |
print(f"command: {j['name']}") | |
answer = {} | |
for q in j['prompt']: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
class command(object): | |
def ratelimit(*args, **kwargs): | |
limit = args[0] | |
def ratelimit_wrapper(func): | |
print(f"rate: {limit}") | |
print("begin: ratelimit_wrapper") | |
# some stuff | |
print("end: ratelimit_wrapper") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Alpha(Cosmos): | |
def __init__(self): | |
self.name = "Alpha.class" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"agent": { | |
"run_as_user": "cwagent" | |
}, | |
"metrics": { | |
"metrics_collected": { | |
"procstat": { | |
"pattern": "/usr/bin/java -jar report-service.jar", | |
"measurement": [ | |
"pid_count" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: all | |
tasks: | |
- name: Installing git | |
become: true | |
become_user: root | |
yum: | |
name: git | |
state: latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function JsonSettings() | |
set expandtab | |
set shiftwidth=2 | |
set tabstop=2 | |
endfunction | |
:command Json :call JsonSettings() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__module_name__ = "wat" | |
__module_version__ = "1.0" | |
__module_description__ = "say wat!" | |
import hexchat | |
import re | |
from datetime import datetime | |
from datetime import timedelta | |
def count_words(somevar): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# adds a device forcefullly in LNMS via the API | |
lnms_api_add: | |
cmd.run: | |
- name: >- | |
curl -X POST --data-binary '{"hostname":"{{ salt['grains.get']('ip4_interfaces:ens18:0') }}","force_add":"true","port":"161","version":"v2c","community":"public"}' -k -v -H 'X-Auth-Token: SOMEAPITOKEN' 'http://192.168.1.85/api/v0/devices' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
alphabet = 'abcdefghijklmnopqrstuvwxyz' | |
chars = list(alphabet) | |
words = ['alpha','bravo','charlie','delta','echo','foxtrot','golf','hotel','india','juliett','kilo','lima','mike','november','oscar','papa','quebec','romeo','sierra','tango','uniform','victor','whiskey','xray','yankee','zulu'] | |
for w in words: | |
# loop through each word specified |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import pandas as pd | |
import numpy as np | |
import sys | |
target = sys.argv[1] | |
def getTargetTotal(target): | |
df = pd.read_csv('data.csv', header=None,names=['date','description','ammount','balance']) |
NewerOlder