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 | |
//Generates random names and puts them in a txt file | |
$fileName = 'nameDatabase.txt'; | |
$mode = 2; //MODE 1: array of names || MODE 2: one name per line | |
$amountOfNames = 100; //Amount of names to be generated | |
$startTime = microtime(true); //Starts timer | |
$adjs = array( | |
'Impressive', | |
'Overwhelming', |
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
public static void bubbleSort(int[] myList) { //USE: bubbleSort(myArray); | |
boolean flag = true; | |
while(flag) { | |
flag = false; | |
for(int i = 0; i < myList.length -1; i++) { | |
if(myList[i] < myList[i+1]) { // swap < for > to change from ascending to descending | |
int temp = myList[i]; | |
myList[i] = myList[i+1]; | |
myList[i+1] = temp; | |
flag = true; |
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
public static void quickSort(int myList[], int left, int right) { | |
int temp, i = left, j = right; | |
int pivot = myList[(left+right)/2]; | |
do { | |
while(myList[i] < pivot) i++; | |
while(pivot < myList[j]) j--; | |
if (i <= j) { | |
temp = myList[i]; | |
myList[i] = myList[j]; | |
myList[j] = temp; |
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
set nocompatible | |
" checks if pathogen is installed and run it if it is | |
if !empty(glob("/root/.vim/autoload/pathogen.vim")) | |
execute pathogen#infect() | |
let g:SuperTabDefaultCompletionType = "<C-X><C-O>" | |
endif | |
" enables syntax highlighting by default. | |
if has("syntax") |
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 | |
#NOTE: | |
# | |
# Une connection internet est necessaire pour le bon | |
# fonctionnement du script, mais meme sil n y a pas | |
# de connection internet, vous allez pouvoir entrer | |
# la temperature manuellement. | |
# |
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 "stdafx.h" | |
#include "iostream" | |
using namespace std; | |
int main() | |
{ | |
for (int i = 0; i < 101; i++) { | |
if (i % 3 == 0 ^ i % 5 == 0) { // can't be both | |
cout << (i % 3 == 0 ? "fizz" : "buzz") << endl; |
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 | |
echo "Updating.." | |
sudo apt-get update &> /dev/null | |
echo "Installing build-essential.." | |
sudo apt-get install build-essential &> /dev/null | |
echo "Installing python2.7-dev.." | |
sudo apt-get install python2.7-dev &> /dev/null | |
echo "Installing git.." | |
sudo apt-get install git &> /dev/null | |
echo "Installing vim.." |
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
public static boolean isInList(String[] myList, String element) { | |
for(String s: myList) { | |
if (s.equals(element)) { return true; } | |
} | |
return false; | |
} | |
public static boolean isInList(char[] myList, char element) { | |
for(char c: myList) { | |
if (c == element) { return true; } | |
} |
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
for i in range(101): | |
if i==0: continue | |
if (i%3==0) ^ (i%5==0): | |
print "fizz" if i%3==0 else "buzz" | |
elif i%3==0: | |
print "fizzbuzz" | |
else: | |
print 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
import urllib2,cookielib | |
''' | |
Function that returns the source from the target url | |
@param url | |
''' | |
def file_get_contents(url): | |
url = str(url).replace(" ", "+") # just in case, no space in url | |
hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11', | |
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', |
OlderNewer