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
#include<stdio.h> | |
#include<strings.h> | |
int main(void) | |
{ | |
/* Looping Variables */ | |
int i = 0, j = 0; | |
int num_states = 4; | |
char *states[]= {"California","Oregon","Washington","Texas"}; |
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
#!/bin/sh | |
#The limit is 30% now | |
limit=10 | |
[email protected] | |
tmp_file=/tmp/diskusage | |
hostname=`hostname` | |
#Now the script will calculate the current disk usage | |
disk=$(df -h | awk 'FNR == 2 {print $5}' | sed 's/%//') |
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
// Wanted to check out the example from Frontend Masters by David Crockford | |
var template = '<table border="{border}">' + // | |
'<tr><th>Last</th><td>{last}</td></tr>' + // Hold table format in var template | |
'<tr><th>First</th><td>{first}</td></tr>' + // | |
'</table>'; // | |
var data = { // values to be replaced with RegEx | |
first: "Carl", // | |
last: "Jose", // |
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
var myClosure = function() { | |
var date = new Date(); | |
var nested = function() { | |
return date.getMilliseconds(); | |
}; | |
return { | |
foo: nested | |
}; | |
}; |
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
escape ^A^A | |
term screen-256color | |
vbell off | |
startup_message off | |
defscrollback 10000 | |
hardstatus off | |
hardstatus alwayslastline | |
# hardstatus string "%{kG}%50>%-w%{ky}%n %t%{-}%+w%{-} %>%=%{ky}Ctrl-A ?%{-} for help" | |
#hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W} %c %{g}]' | |
hardstatus string '%{= kG}[%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W} %c %{g}]' |
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
units = [1 << (8*i) for i in range(3,-1,-1)] | |
def ip_to_int(ip): | |
return sum(int(byte) * unit for(byte,unit) in zip(ip.split('.'), units)) | |
def int_to_ip(i): | |
return '.'.join(str((i/bit) & 0xff) for bit in units) | |
start_ip = '1.0.0.0' | |
end_ip = '1.0.0.255' |
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 User(UserMixin, db.Model): | |
__tablename__ = 'users' | |
id = db.Column(db.Integer, primary_key=True) | |
name = db.Column(db.String(16), index=True, unique=True) | |
username = db.Column(db.String(16), index=True, unique=True) | |
password_hash = db.Column(db.String(64)) | |
def set_password(self, password): |
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 MyClass(object): | |
"""A simple class example""" | |
# Class OBJECTS support two kinds of operations | |
# 1. Attribute reference | |
# 2. Instantiation | |
i = 12345 | |
def something(self): | |
print 'printing - hello world' | |
return "returning - Hi" |
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 python | |
#-*- coding:utf8 -*- | |
# sources | |
# 1. https://gist.github.com/tell-k/4943359#file-paramiko_proxycommand_sample-py-L11 | |
# 2. https://github.com/paramiko/paramiko/pull/97 | |
# info: http://bitprophet.org/blog/2012/11/05/gateway-solutions/ | |
# local -> proxy-server -> dest-server | |
# ~/.ssh/config | |
# | |
# Host proxy-server |
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
''' | |
Requires paramiko >=1.8.0 (paramiko had an issue with multiprocessing prior | |
to this) | |
Example code showing how to use netmiko for multiprocessing. Create a | |
separate process for each ssh connection. Each subprocess executes a | |
'show version' command on the remote device. Use a multiprocessing.queue to | |
pass data from subprocess to parent process. | |
Only supports Python2 |
OlderNewer