Skip to content

Instantly share code, notes, and snippets.

View lucasmelin's full-sized avatar
🥽
Poking at stuff

Lucas Melin lucasmelin

🥽
Poking at stuff
View GitHub Profile
@lucasmelin
lucasmelin / thumbnail-display-case
Last active August 29, 2015 14:10
A Bootstrap thumbnail display case that reorders the images based on the size of the browser window.
<div class="row">
<div class="col-xs-12 col-md-6 col-md-push-6">
<a href="#" class="thumbnail">
<img src="/image1" alt="alt1">
</a>
<div class="row">
<div class="col-xs-4 col-md-6">
<a href="#" class="thumbnail">
<img src="image2" alt="alt2">
</a>
@lucasmelin
lucasmelin / blankwebpage.html
Last active August 29, 2015 14:10
Simple webpage built for a website that hosts all content in an iframe.
<!DOCTYPE html>
<html>
<head>
<title>
Page Template
</title>
</head>
<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0>
<style>
.sf {
@lucasmelin
lucasmelin / TaskIsCompleteComparator.java
Created April 25, 2016 16:20
Sorting using completion comparator
import java.util.Comparator;
public class TaskIsCompleteComparator implements Comparator<Task>{
@Override
public int compare(Task t1, Task t2){
return Boolean.compare(t1.getIsComplete(), t2.getIsComplete());
}
}
@lucasmelin
lucasmelin / ToggleTaskComplete.java
Last active April 25, 2016 16:25
Toggles task completion by inverting the boolean
/**
* Toggles task completion boolean.
* <p>
* Checks that there are tasks.
* Asks user for index of Task in the ArrayList to toggle.
* After obtaining the Task from the ArrayList flip the isCompleted boolean.
*/
private void toggleTaskComplete(){
if (tasks.isEmpty()==false){ // Make sure there are tasks
System.out.println("What is the index of the task you'd like to toggle?");
@lucasmelin
lucasmelin / SaveTasks.java
Last active February 19, 2018 16:49
Save tasks to a file using FileWriter and an enhanced for-loop.
/**
* Saves tasks found in the ArrayList to a file.
* <p>
* Each task is separated by a newline,
* and the tasks are formatted using the createTabRecord method, which separates the values
* of the task with tab characters. This method also overwrites any previous files of the
* same name.
*/
private void saveTasks(){
if (tasks.isEmpty()){ // Make sure tasks ArrayList isn't empty
@lucasmelin
lucasmelin / bubblesort.py
Created May 9, 2016 14:05
BubbleSort Python Implementaton
for i in xrange(len(1)):
for j in xrange(len(1)):
if 1[i]>1[j]:
l[i], l[j] = l[j], l[i]
print (1[i])
@lucasmelin
lucasmelin / guess.py
Created May 9, 2016 14:06
Simple number guessing game
import random
secret = random.randint(0, 100)
guess = 0
tries = 0
print ("Try to guess the number between 1 and 100!")
print ("You have 7 tries.")
while guess != secret and tries < 7:
guess = int(input("What is your guess? "))
if guess < secret:
print ("Too low, try again")

Keybase proof

I hereby claim:

  • I am lucasmelin on github.
  • I am lucasmelin (https://keybase.io/lucasmelin) on keybase.
  • I have a public key whose fingerprint is 2E63 0DD5 92C5 5200 81E2 37AD 7A75 CC9E 065D D11A

To claim this, I am signing this object:

@lucasmelin
lucasmelin / extract.py
Created February 21, 2018 04:35
Python script to extract unique rows from a csv
with open('input.csv','r') as in_file, open ('output.csv','w') as out_file:
seen = set()
for line in in_file:
if line in seen: continue
seen.add(line)
out_file.write(line)
@lucasmelin
lucasmelin / disabledusers.ps1
Created February 21, 2018 05:00
Powershell script to get all disabled Active Directory users
Get-ADUser -Filter * -SearchBase "ou=Disabled Accounts" -Searchscope "onelevel" | select givenname,surname,samaccountname,whenchanged | Out-File "disabled_users.txt"