Skip to content

Instantly share code, notes, and snippets.

View msaroufim's full-sized avatar
🤖
Putting the finishing touches on my robot army

Mark Saroufim msaroufim

🤖
Putting the finishing touches on my robot army
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
using UnityEngine;
using System.Collections;
using System;
using System.Runtime.Serialization;
[Serializable]
public class BaseEffect {
[NonSerialized]
public Unit AttachedUnit;
[Serializable]
public class ZapEffect : BaseEffect {
private int[] _damagePerCharge = new int[] { 1, 2, 3 };
public override void Apply()
{
int multiplier = (Ability as Spell).Charges.Percentage == 1 ? 2 : 1;
int damage = _damagePerCharge[Ability.Level] * (Ability as Spell).Charges.Current * multiplier;
BattleApp.Instance.ResolveDamage(damage, BattleApp.Instance.CurrentPlayer, BattleApp.Instance.CurrentTarget, DamageType.Wind);
@ygrenzinger
ygrenzinger / CleanArchitecture.md
Last active May 20, 2024 05:21
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.

@sonots
sonots / nvvp.md
Last active April 24, 2024 13:54
How to use NVIDIA profiler

Usually, located at /usr/local/cuda/bin

Non-Visual Profiler

$ nvprof python train_mnist.py

I prefer to use --print-gpu-trace.

@Peng-YM
Peng-YM / MST.py
Last active June 18, 2021 02:06
Prim and Kruskal algorithm written in Python
# coding: utf-8
import re
# Class WeightedGraph
class WeightedGraph:
def __init__(self, path):
# open file to initialize the graph
file = open(path, "r")
p = re.compile("\d+")
@sebble
sebble / stars.sh
Last active May 17, 2024 20:59
List all starred repositories of a GitHub user.
#!/bin/bash
USER=${1:-sebble}
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-)
PAGES=$((658/100+1))
echo You have $STARS starred repositories.
echo
@wojteklu
wojteklu / clean_code.md
Last active May 28, 2024 04:05
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@cyhsutw
cyhsutw / MathJax.ipynb
Last active May 14, 2024 07:31
Grabbed from https://github.com/odewahn/ipynb-examples, converted to v3 for GitHub to render.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward