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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
$script = <<SCRIPT | |
set -x | |
echo I am provisioning... | |
date > /etc/vagrant_provisioned_at | |
apt-get update | |
echo "America/Los_Angeles" | sudo tee /etc/timezone | |
ntpdate -u pool.ntp.org |
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
import java.util.*; | |
public class decodingcountDP { | |
static int calls = 0; | |
static Map<Integer, String> codes = new HashMap<Integer, String>(); | |
private static void construct(){ | |
codes.put(1, "A"); | |
codes.put(2, "B"); |
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
use strict; | |
use warnings; | |
use ElectricCommander; | |
# Turn off buffering | |
$| = 1; | |
my $ec = new ElectricCommander(); | |
my $xpath = $ec->findObjects("job", |
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
if [ "$[/myJob/latestBuildOutcome]" = "success" ] | |
then | |
outcome="Green" | |
curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Latest Build - $[/myJob/latestBuild] ran for '$[/myJob/latestBuildElapsedTime]' hours, and was '$outcome' woo! ", "isGreen": 3}' \http://yourdashingurl:3030/widgets/welcome | |
else | |
outcome="Red" | |
curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "$[/myJob/latestBuild] ran for $[/myJob/latestBuildElapsedTime] hours, and was '$outcome'! ", "isRed": 3}' \http://yourdashingurl:3030/widgets/welcome | |
fi |
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
def main(): | |
myfile = open('words.txt', 'r') | |
outfile = open('wordsoutput.txt', 'w') | |
for line in myfile: | |
line_list = line.split('::') | |
new_line = ','.join(line_list[:-1]) | |
outfile.write(new_line) | |
outfile.write('\n') | |
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
def main(): | |
myfile = open('result.txt', 'r') | |
myfile2 = open('movies.txt', 'r') | |
myfile3 = open('finalrecos.txt', 'w') | |
content = myfile2.read() | |
i = 0 | |
for line in myfile: | |
m = re.search(r'(?<=RecommendedItem\[item:)(\d+)',line) | |
i+=1 | |
n = re.search(r'(?<='+m.group(0)+r'\:\:)(.+)(?=::)',content) |
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
# A python script which anonymizes email addresses in all files in current directory and sub-directories. | |
# e.g. A file with the following contents: | |
# siddhartha@gmail.com | |
# Sid Phn#- 6385833322 | |
# gupta49@illinois.edu | |
# weee@as.cd | |
# sid@yahoo.co.in | |
# Would change to: |
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
import http.server | |
import socketserver | |
from time import sleep | |
PORT = 5000 | |
SLEEP_TIME = 6 | |
class SlowHandler(http.server.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
sleep(SLEEP_TIME) |
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
ls | |
mkdir basicscript |