Skip to content

Instantly share code, notes, and snippets.

@pahud
pahud / cdk-resource-dependson-parameter-demo.ts
Last active December 29, 2020 01:55
create CDK L2 resource depends on parameter demo
import { App, Construct, Stack, StackProps, CfnParameter, CfnCondition, Fn } from '@aws-cdk/core';
import * as sns from '@aws-cdk/aws-sns';
export interface DemoProps { }
export class Demo extends Construct {
constructor(scope: Construct, id: string) {
super(scope, id)
const stack = Stack.of(this);
@cajames
cajames / fargate-efs-cdk-stack.ts
Last active July 26, 2023 08:40
Sample Fargate + EFS CDK Stack. Written up here: https://caj.ms/writing/aws-fargate-with-efs
import cdk = require("@aws-cdk/core");
import { Vpc, Port } from "@aws-cdk/aws-ec2";
import {
Cluster,
ContainerImage,
AwsLogDriver,
FargatePlatformVersion,
NetworkMode,
CfnService,
} from "@aws-cdk/aws-ecs";
/*
* one.c -- Lua core, libraries, and interpreter in a single file (Lua 5.3)
*/
/* default is to build the full interpreter */
#ifndef MAKE_LIB
#ifndef MAKE_LUAC
#ifndef MAKE_LUA
#define MAKE_LUA
#endif
@tsu-nera
tsu-nera / dqn_cartpole_numpy.py
Created July 9, 2017 08:42
DQN cartpole with numpy only
import gym
import numpy as np
from collections import deque
from gym import wrappers
# Create the Cart-Pole game environment
env = gym.make('CartPole-v0')
env = wrappers.Monitor(env, '/tmp/cartpole-experiment-1')
def relu(x):
#!/usr/bin/python3
from sys import exit
from sys import stdout
from sys import path as syspath
from os import path as osp
from os import stat, makedirs
import argparse
from shutil import copyfile
@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
@aaronpolhamus
aaronpolhamus / map_clsloc.txt
Created May 12, 2016 01:21
Image net classes + labels
n02119789 1 kit_fox
n02100735 2 English_setter
n02110185 3 Siberian_husky
n02096294 4 Australian_terrier
n02102040 5 English_springer
n02066245 6 grey_whale
n02509815 7 lesser_panda
n02124075 8 Egyptian_cat
n02417914 9 ibex
n02123394 10 Persian_cat
@karpathy
karpathy / min-char-rnn.py
Last active July 22, 2024 04:44
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@karpathy
karpathy / gist:587454dc0146a6ae21fc
Last active July 11, 2024 10:36
An efficient, batched LSTM.
"""
This is a batched LSTM forward and backward pass
"""
import numpy as np
import code
class LSTM:
@staticmethod
def init(input_size, hidden_size, fancy_forget_bias_init = 3):
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule