Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
# create sorting python in list csv
from random import shuffle
import os
class DoorPrize(object):
def __init__(self, list_to_sort=[]):
self.list_to_sort = list(set(list_to_sort))
# Install dependencies
yum groupinstall -y 'development tools'
yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget
# Download the Python source and unpack it
wget http://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz
xz -d Python-2.7.9.tar.xz
tar -xvf Python-2.7.9.tar
# Enter the directory, configure, and install
import calendar
from datetime import datetime, date, timedelta
class Agenda(object):
def __init__(self):
self._month = datetime.today().month
self._year = datetime.today().year
# -*- coding: utf-8 -*-
import os
import unicodedata
from collections import defaultdict, Counter
from operator import itemgetter, attrgetter
local = os.path.dirname(__file__)
file_imput = local + '/natural_keys_scl.csv'
file_out = local + '/natural_keys_output.csv'
# https://www.hackerrank.com/challenges/ruby-enumerable-collect
def rot(string, num)
if num > 25
num = num - (25 *(num/25))
end
new_UpFirst = (65 + num).chr
new_UpLast = (65 + num - 1).chr
new_DwnFirst = (97 + num).chr
new_DwnLast = (97 + num - 1).chr
case num
# https://www.hackerrank.com/challenges/pairs
def pairs(ar,diff)
count = 0
hash = Hash[ar.zip]
ar.each do |x|
if(hash[x] == nil)
ahead = x + diff
behind = x - diff
if(hash.has_key?(ahead) and (hash[ahead] == nil) )
count +=1
/*
* Date..: 11/06/2016
* Prototype developed in Bluehack event on IBM
*/
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>
FROM python:2.7
RUN mkdir -p /opt/app
WORKDIR /opt/app
RUN apt-get update && apt-get install awscli libmemcached-dev -y
RUN mkdir -p /opt/app/static
#RUN aws s3 sync s3://rootair.cdn/development/static/whitelabel /opt/app/static/whitelabel
RUN chmod -R a+rx /opt/app/static
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'cep' })
export class CepPipe implements PipeTransform {
transform(value: string): string {
return value.substr(0, 5) + '-' + value.substr(5, 3);
}
}
@Pipe({ name: 'iterable', pure: false })
<!DOCTYPE html>
<html>
<body>
<p>Click the button to get your coordinates.</p>
<button id ='getCoordinates'>Try It</button>
<p id='coordinates'></p>