Skip to content

Instantly share code, notes, and snippets.

View TwiN's full-sized avatar
Extremely busy

TwiN

Extremely busy
View GitHub Profile
@TwiN
TwiN / baseInstall.sh
Created May 21, 2016 16:40
First file I run when I install a ubuntu vm/vps
#!/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.."
@TwiN
TwiN / fizzbuzz.cpp
Last active May 19, 2016 23:40
my version of fizzbuzz in C++
#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;
#!/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.
#
@TwiN
TwiN / .vimrc
Last active December 26, 2016 20:40
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")
@TwiN
TwiN / [JAVA]quickSort.java
Created March 26, 2016 23:02
Java quick sort
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;
@TwiN
TwiN / [JAVA]bubbleSort.java
Created March 26, 2016 23:01
Java bubbleSort
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;
@TwiN
TwiN / nameGenerator.php
Created January 10, 2016 23:40
Generates random names and puts them in a .txt file
<?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',