Skip to content

Instantly share code, notes, and snippets.

View samueljackson92's full-sized avatar

Samuel Jackson samueljackson92

  • UKAEA
  • Wallingford, Oxfordshire, UK
View GitHub Profile

Recipes

Red Lentil Dal with Coconut Milk and Kale

Ingredients:

  • 3 tablespoons coconut oil
  • 1 teaspoon cumin seeds
  • 1 teaspoon fennel seeds
  • 1 teaspoon ground turmeric
  • 2 onions, halved and thinly sliced

Xmas List

Books

Name Author Price Link
A Void Georges Perac £8.99 [Link][0]
The Signal and the Noise Nate Silver £7.49 [Link][1]
Graphic Work M.C. Escher £8.99 [Link][2]
The Master And Margarita Mikhail Bulgakov £7.99 [Link][3]
delete mode 100644 src/ASP.NET/GoAber/GoAber.Tests/bin/Debug/DotNetOpenAuth.Core.UI.dll
delete mode 100644 src/ASP.NET/GoAber/GoAber.Tests/bin/Debug/DotNetOpenAuth.Core.UI.xml
delete mode 100644 src/ASP.NET/GoAber/GoAber.Tests/bin/Debug/DotNetOpenAuth.Core.dll
delete mode 100644 src/ASP.NET/GoAber/GoAber.Tests/bin/Debug/DotNetOpenAuth.Core.xml
delete mode 100644 src/ASP.NET/GoAber/GoAber.Tests/bin/Debug/DotNetOpenAuth.InfoCard.UI.dll
delete mode 100644 src/ASP.NET/GoAber/GoAber.Tests/bin/Debug/DotNetOpenAuth.InfoCard.UI.xml
delete mode 100644 src/ASP.NET/GoAber/GoAber.Tests/bin/Debug/DotNetOpenAuth.InfoCard.dll
delete mode 100644 src/ASP.NET/GoAber/GoAber.Tests/bin/Debug/DotNetOpenAuth.InfoCard.xml
delete mode 100644 src/ASP.NET/GoAber/GoAber.Tests/bin/Debug/DotNetOpenAuth.OAuth.Common.dll
delete mode 100644 src/ASP.NET/GoAber/GoAber.Tests/bin/Debug/DotNetOpenAuth.OAuth.Common.xml
@samueljackson92
samueljackson92 / controller.java
Last active November 11, 2015 16:20
Prime faces ajax filtering
private Date fromDate;
private Date toDate;
public void filterDataTable() {
items = getFacade().findAll();
for (Iterator<ActivityData> iterator = items.iterator(); iterator.hasNext();) {
Date date = iterator.next().getDate();
if (getFromDate() != null && date.before(getFromDate())
|| getToDate() != null && date.after(getToDate())) {
iterator.remove();
class TwoPointPMX(AbstractCrossover):
"""Create a new population using one point PMX crossover. The pivot location
of the split is determined uniformly at random.
"""
def _crossover_for_chromosomes(self, x, y):
pivot1 = np.random.randint(x.size/2)
pivot2 = np.random.randint(x.size/2, x.size)
child1 = y.copy()
child2 = x.copy()
@samueljackson92
samueljackson92 / plotting.py
Created November 9, 2015 09:40
Plotting for genetic algorithms
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
plt.plot(sim.get_averge_fitness())
plt.plot(sim.get_min_fitness())
plt.plot(sim.get_max_fitness())
plt.show()
plt.scatter(self._data[:, 0], self._data[:, 1])

Git Commands I Always Forget

Performing an interactive rebase:

git rebase --interactive <hash>~
git add stuff/to/add
git commit
git rebase --continue
@samueljackson92
samueljackson92 / grades.csv
Created September 20, 2015 15:50
Module results for my course so far
Module Name Grade
CS10110 Introduction To Computer Hardware, Operating Systems And Unix Tools 87.0
CS10410 The Mathematics Driving License For Computer Science 95.0
CS12130 Concepts In Programming 87.0
PH19510 Chaos, Communications And Consciousness 90.0
CS12420 Software Development 91.0
CS15020 Web Development Tools 94.0
CS15210 An Introduction To Communications And Telematics 66.0
CS18010 Professional And Personal Development 71.0
CS20410 The Advanced Mathematics Driving License For Computer Science 70.0
@samueljackson92
samueljackson92 / git-revert-merges
Last active August 29, 2015 14:27
Bash git script to revert n pull requests from a git repo. The command will squash each of the reverts into a single commit to keep the history cleaner. A commit message must also be supplied as an argument.
#!/bin/bash
usage="$(basename "$0") [-h] <n> <commit-message> -- revert back n pull requests
where:
-h show this help text"
while getopts ':h:' option; do
case "$option" in
h) echo "$usage"
exit
"""Showing the cool stuff which functools does"""
import functools
def print_shit(f):
"""Because Sam, you need to learn why decorators are sexy.
Plus, functool.wraps() is a _very_ important tool, yo
"""
@functools.wraps(f)
def inner(*args, **kwargs):