This file contains hidden or 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
import curses | |
SCREEN_WIDTH, SCREEN_HEIGHT = 100, 100 | |
class curses_screen: | |
def __enter__(self): | |
"""Initialize""" | |
self.stdscr = curses.initscr() | |
curses.cbreak() | |
curses.noecho() |
This file contains hidden or 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
with curses_screen() as stdscr: | |
""" | |
Execution of the curses begins here. | |
""" | |
# Retrieve the size of the terminal currently open. | |
SCREEN_HEIGHT, SCREEN_WIDTH = stdscr.getmaxyx() | |
# Create the pad | |
mypad = curses.newpad(SCREEN_HEIGHT, SCREEN_WIDTH) | |
# Refresh the pad |
This file contains hidden or 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
import datetime | |
import thread | |
import sys | |
""" | |
Pass either 'Replicate' or 'Fix' as the | |
parameter while running the file. | |
""" | |
def print_time( threadName, delay): |
This file contains hidden or 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
""" | |
Dumps html from http://www.wordnik.com/ for the words mentioned in the | |
file 'only_words'. An appendix html is also created named as 'words.html', | |
which contains the link to the dumped htmls of corresponding words. | |
""" | |
import os | |
for line in [ line.rstrip('\n') for line in open('only_words') ]: | |
fw = open('words.html', 'a') |
This file contains hidden or 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/bash | |
# find if Apache (httpd) running or not | |
service_list=('application_errormonitor.py' 'controller_errormonitor.py') | |
COUNTER=0 | |
for service in ${service_list[@]} | |
do | |
echo "----------------" | |
if ps ax | grep -v grep | grep $service > /dev/null; then | |
echo "$service service running, everything is fine" |
This file contains hidden or 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
def restart(timeout=5): | |
""" | |
Script polls the process checking | |
for the status of the process. | |
""" | |
status, success = "Restart successfull....", True | |
start = datetime.now() | |
proc = subprocess.Popen(CMD, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
# Polling to have process timeout |
This file contains hidden or 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
int main(int argc, char *argv[]) | |
{ | |
int i=1; | |
void *output; | |
pthread_t thread; | |
int status = pthread_create(&thread, | |
NULL, | |
server, | |
(void*)i); |
This file contains hidden or 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 <time.h> | |
#include <signal.h> | |
int handler(); | |
void show_status(); | |
int long_running_procedure( struct timespec time_sleep, struct timespec time_rem); | |
int status = 0; |
This file contains hidden or 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/testbed/bin/mkextrafs /mnt |
This file contains hidden or 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
# Download the kernel | |
>> cd /mnt/local | |
>> wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.16.tar.gz | |
>> sudo apt-get install libncurses5-dev libncurses5 | |
>> tar -xvf linux-3.2.63.tar.gz | |
>> cd linux-3.2.63 | |
>> make menuconfig | |
# Build the kernel | |
>> make && make modules && make modules_install && make install | |
>> sudo reboot |
OlderNewer