Skip to content

Instantly share code, notes, and snippets.

View ixaxaar's full-sized avatar
🏔️

ixaxaar ixaxaar

🏔️
View GitHub Profile
@ixaxaar
ixaxaar / nbody.md
Created August 28, 2024 17:21 — forked from Atlas7/nbody.md
High Performance Computing (HPC) with Intel Xeon Phi: N-body Simulation Example

Abstract

Imagine we have n particles in our "universe". These particles have a random initial x, y, and z coordinates to begin with. Defined by Newton's law of universal gravitation, each particle attracts every other particles in this universe using a force that is directly proportional to the product of their masses and inversely proportional to the square of the distance between their centers. As as result, these particles gain (and lose) velocities and change positions over time. The modelling of this physical mechanics is called a N-body simulation.

There currently exists many N-body simulation algorithms. Some are less advanced and highly computational costly (execution time in the order of O(N^2)) - but simple and easy to understand. Some others are more advanced and significantly more efficient (execution in the order of O(n*log(n)) - but not as simple and easy to understand. This articles focuses on the implementation aspect of the less advanced toy algorithm - for the benefit of ease o

@ixaxaar
ixaxaar / AgdaBasics.agda
Created February 8, 2019 07:02 — forked from bitonic/AgdaBasics.agda
Agda tutorial
module AgdaBasics where
apply : (A : Set)(B : A → Set) → ((x : A) → B x) → (a : A) → B a
apply A B f a = f a
_∘_ : {A : Set}{B : A → Set}{C : (x : A) → B x → Set}
(f : {x : A}(y : B x) → C x y)(g : (x : A) → B x)
(x : A) → C x (g x)
(f ∘ g) x = f (g x)
@ixaxaar
ixaxaar / install-chrome.sh
Last active September 19, 2018 06:39 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/bin/bash
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install -y google-chrome-stable
@ixaxaar
ixaxaar / inception_v3.py
Created July 5, 2016 10:38 — forked from neggert/inception_v3.py
Inception-v3 implementation in Keras
from keras.models import Model
from keras.layers import (
Input,
Dense,
Flatten,
merge,
Lambda
)
from keras.layers.convolutional import (
Convolution2D,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ixaxaar
ixaxaar / event_export.py
Created February 23, 2016 14:18 — forked from drmarshall/event_export.py
Example Mixpanel raw event export script
#! /usr/bin/env python
#
# Mixpanel, Inc. -- http://mixpanel.com/
#
# Python API client library to consume mixpanel.com analytics data.
import hashlib
import urllib
import time
try:
@ixaxaar
ixaxaar / CorsSupport.scala
Last active September 18, 2015 13:16 — forked from joseraya/CorsSupport.scala
CORS directive for Spray
package com.agilogy.spray.cors
import spray.http.{HttpMethods, HttpMethod, HttpResponse, AllOrigins}
import spray.http.HttpHeaders._
import spray.http.HttpMethods._
import spray.routing._
// see also https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
trait CORSSupport {
this: HttpService =>
@ixaxaar
ixaxaar / live_plot.py
Last active August 29, 2015 14:19 — forked from swenzel/live_plot.py
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2015 Swen Wenzel <[email protected]>
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
/*
This example uses Scala. Please see the MLlib documentation for a Java example.
Try running this code in the Spark shell. It may produce different topics each time (since LDA includes some randomization), but it should give topics similar to those listed above.
This example is paired with a blog post on LDA in Spark: http://databricks.com/blog
Spark: http://spark.apache.org/
*/
import scala.collection.mutable
# DATA FRAME OPERATIONS IN R
# Create data frame
# A dataset is ~ table (list of vectors)
id <- c(1,2,3)
name <- c("John", "Kirk", "AJ")
age <- c(21,27,18)
employees <- data.frame(ID=id, Name=name, Age=age)
employees