Archiving script for exising buckets in s3. To use make install s3cmd.
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
| # treating each 16-bit word as an integer | |
| # devisor = 16 | |
| # mod = (2**16-1) | |
| words = [ | |
| int('1111111111111111', 2), | |
| int('1111111100000000', 2), | |
| int('1111000011110000', 2), | |
| int('1100000011000000', 2), | |
| ] |
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
| {{/* | |
| imagePullPolicy: | |
| this function will parse the imageTag with semver | |
| imagePullPolicy is determined based of a versions prerelease | |
| example usage: | |
| ``` | |
| image: {{ .Values.ImageTag }} | |
| {{ include "imagePullPolicy" .Values.ImageTag | indent 8 }} | |
| env: ... |
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
| // this is based on a blog post from @relistan, http://relistan.com/writing-testable-apps-in-go/ | |
| package main | |
| import ( | |
| "errors" | |
| "fmt" | |
| "strings" | |
| ) |
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
| common_packages <- c('batch','data.table','plyr','sqldf') | |
| ## adjust as necessary, see help('download.packages') | |
| repos <- "http://cran.rstudio.com" | |
| ## this makes sense on Debian where no packages touch /usr/local | |
| lib.loc <- "/usr/local/lib/R/site-library/" | |
| ## install packages | |
| sapply(common_packages, function (pkg) install.packages(pkg, lib.loc, repos)) |
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
| days = range(16,30) # the days of the month= | |
| p = "ALTER TABLE set_videoads_valid ADD IF NOT EXISTS PARTITION (year={year:d}, month={month:d}, day={day:d}, hour={hour:d}) LOCATION 'hdfs://spil-hadoop/datain/set/portal/valid/year={year:04d}/month={month:02d}/day={day:02d}/hour={hour:02d}'; " | |
| print "USE datain; " | |
| for x in days: | |
| for h in range(0,24): | |
| print p.format(year=2014, month=7, day=x, hour=h) |
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
| from ConfigParser import ConfigParser | |
| class LoaderConfig(dict): | |
| def __init__(self, config_path, section): | |
| _dyn_kwargs = self.load_config(config_path) | |
| super(LoaderConfig, self).__init__(_dyn_kwargs[section]) | |
| self.__dict__ = self |
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
| package require http | |
| namespace eval twitter { | |
| variable status_url "http://api.twitter.com/1/statuses/user_timeline/" | |
| bind pub -|- "!twitter" twitter::tweet | |
| } | |
| proc twitter::tweet {nick uhost hand chan argv} { | |
| if {[string length $argv] < 1} { |
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 logging | |
| import logging.config | |
| console = { | |
| 'class': 'logging.StreamHandler', | |
| 'formatter': 'console', | |
| 'level': 'NOTSET', # log everything!! | |
| } | |
| logfile = { |
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
| <?php | |
| //if this php version is greater than 5.1 pass | |
| echo strtotime('1766-06-04') . '<br />'; | |
| if (version_compare(PHP_VERSION, '5.1', '>')) { | |
| echo 'we support negative dates'; | |
| } else { | |
| echo 'we DON'T support negative dates'; | |
| } |
NewerOlder