Skip to content

Instantly share code, notes, and snippets.

@martenc
martenc / grpo_demo.py
Created February 3, 2025 00:00 — forked from willccbb/grpo_demo.py
GRPO Llama-1B
# train_grpo.py
import re
import torch
from datasets import load_dataset, Dataset
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer
# Load and prep dataset
@martenc
martenc / .dockerignore
Created September 1, 2021 15:00 — forked from remarkablemark/.dockerignore
Docker Node.js Example
node_modules/
*.log
/*
JavaScript: Higher Order Functions
Part 2, JavaScript Map Method by Example
YouTube Video: http://uzr.co/javascript-map-method
JSFiddle: https://jsfiddle.net/joeyburzynski/j2bewfe9/
Gist: https://gist.github.com/JoeyBurzynski/91e0ea5f480f5f6bfbcca5df832225b7
@martenc
martenc / stack.js
Created April 30, 2021 15:39 — forked from bradtraversy/stack.js
Stack data structure
class Stack {
constructor() {
this.items = []
this.count = 0
}
// Add element to top of stack
push(element) {
this.items[this.count] = element
console.log(`${element} added to ${this.count}`)
@martenc
martenc / README.md
Last active July 7, 2021 16:03 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery (Vanilla)

Events

// jQuery
$(document).ready(function() {
  // code
})
@martenc
martenc / Makefile
Created February 25, 2021 18:31 — forked from thomaspoignant/Makefile
My ultimate Makefile for Golang Projects
GOCMD=go
GOTEST=$(GOCMD) test
GOVET=$(GOCMD) vet
BINARY_NAME=example
VERSION?=0.0.0
SERVICE_PORT?=3000
DOCKER_REGISTRY?= #if set it should finished by /
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true
GREEN := $(shell tput -Txterm setaf 2)
@martenc
martenc / sass-7-1-pattern.scss
Created August 4, 2019 18:06 — forked from rveitch/sass-7-1-pattern.scss
Sass 7-1 Pattern
sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| ... # Etc…
|
|– components/
| |– _buttons.scss # Buttons
| |– _carousel.scss # Carousel
@martenc
martenc / express-server-side-rendering.md
Created August 30, 2018 15:27 — forked from joepie91/express-server-side-rendering.md
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
@martenc
martenc / heroku_env_copy.sh
Created June 27, 2018 00:53 — forked from jamesr2323/heroku_env_copy.sh
Script to copy environment variables from an existing heroku app to another one
#!/bin/bash
# Source: http://blog.nonuby.com/blog/2012/07/05/copying-env-vars-from-one-heroku-app-to-another/
set -e
sourceApp="$1"
targetApp="$2"
config=""
@martenc
martenc / instafeedjsaccess.md
Created May 1, 2018 18:54 — forked from mojaray2k/instafeedjsaccess.md
Getting Instagram Access Token for http://intafeedjs.com

#Use this URL to get your client authorized for Instafeed.JS plugin for Instagram.

  1. First login into your Instargam account
  2. Then go to https://www.instagram.com/developer/
  3. At the top click on the Button that says "Manage Clients".
  4. If you have not Register a new client.
  5. Fill out everything and where it says redirect url put this url: http://instafeedjs.com
  6. Then on the security tab make sure you uncheck "Disable implicit OAuth"
  7. Finally use this link to authoruize Instafeed. Where it says "[Client ID]" replace that including the brackets with your clientID from instagram:
  8. https://instagram.com/oauth/authorize/?client_id=[Client ID]&redirect_uri=http://instafeedjs.com&response_type=token