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 collections import Counter | |
cnt = Counter("abracadabra") | |
print cnt | |
s = 'abracadabra' | |
d={} | |
for c in s: | |
d[c] = d.get(c, 0)+1 | |
print d |
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
using System.Collections.Generic; | |
using OdeToFood.Models; | |
namespace OdeToFood.Queries | |
{ | |
public static class RestaurantReviewQueries | |
{ | |
//... | |
public static RestaurantReview FindTheBest(this IQueryable<RestaurantReview> reviews) | |
{ |
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 java.util.Scanner; | |
import java.text.DecimalFormat; | |
public class Temperature | |
{ | |
public static void main (String [] args) | |
{ | |
Scanner keyboard = new Scanner(System.in); | |
double celsius; | |
System.out.print("Enter a degree in Celsius: "); |
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
@echo off | |
FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V | |
IF (%adminTest%)==(Access) goto noAdmin | |
for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :do_clear "%%G") | |
echo. | |
echo goto theEnd | |
:do_clear | |
echo clearing %1 | |
wevtutil.exe cl %1 | |
goto :eof |
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 cProfile | |
import pstats | |
def fizbuzz1(): | |
for i in range(1, 101): | |
if (i % 3== 0) and (i % 5 == 0): | |
print('FizzBuzz') | |
elif i % 3 == 0: | |
print ('fizz') | |
elif i % 5 == 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
def fix_addresses(): | |
""" | |
checks file that already only have multiple addresses | |
""" | |
print "reading input file" | |
input_file = open('inputfile.csv') | |
reader = csv.reader(input_file, | |
dialect='excel', | |
delimiter=',') |
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 <iostream> | |
using namespace std; | |
struct CommonBase | |
{ | |
public: | |
CommonBase(); | |
CommonBase(int); | |
virtual ~CommonBase(); | |
int getC(){return c;} |
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 string import find | |
def testContents(contents, lineNumber, totalLines): | |
index = string.find(contents, " ") | |
if(index == -1): | |
editor.deleteLine(lineNumber) | |
return 0 | |
else: | |
editor.replaceWholeLine(lineNumber, contents[index+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
with open('dict.txt', 'w') as outfile: | |
for char in range(ord('A'), ord('Z')+1): | |
outfile.write(open('subdir/' + chr(char) + ' sdict.txt', 'r').read()) |
NewerOlder