Skip to content

Instantly share code, notes, and snippets.

View jorupp's full-sized avatar

Jonathan Rupp jorupp

  • Rightpoint Consulting
  • Chicago, IL
View GitHub Profile
@jorupp
jorupp / gist:b09879f35858e9692461
Created January 10, 2015 00:50
Expression-to-avoid-reflection example
/**
Simple example to show off a way of using expressions to avoid doing reflection for each item to process.
Example results:
TestSimple with 300000 items: 00:00:00.0003998 setup, 00:00:02.3790693 processing
TestCache1 with 300000 items: 00:00:00.0005534 setup, 00:00:02.4511439 processing
TestCache2 with 300000 items: 00:00:00.0048780 setup, 00:00:00.1950776 processing
**/
public class MyClass {
@jorupp
jorupp / gist:2af4d8583bd592b8331f
Created March 4, 2015 15:43
Lock all media queries in their current state
function process(rule) {
if(rule.cssRules) {
for(var i=rule.cssRules.length-1; i>=0; i--) {
process(rule.cssRules[i]);
}
}
if(rule.type == CSSRule.MEDIA_RULE) {
if(window.matchMedia(rule.media.mediaText).matches) {
rule.media.mediaText = "all";
} else {
@jorupp
jorupp / gist:b99522397504283c9ba1
Created March 4, 2015 15:52
Execute the JS tests from the Chrome Accessibility Developer Tools via the browser console
$.getScript('https://rawgit.com/GoogleChrome/accessibility-developer-tools/stable/dist/js/axs_testing.js', (function() { var r = axs.Audit.run(function() { var c = new axs.AuditConfiguration; c.scope = $("body")[0]; return c; }()); console.log(axs.Audit.createReport(r)); var rr = {}; for(var i in r) { rr[r[i].result] = (rr[r[i].result] || []); rr[r[i].result].push(r[i]); } console.log(rr); }));
@jorupp
jorupp / msdn.cs
Created May 27, 2015 23:24
Wander around MSDN downloads
void Main()
{
GetFilesForProduct(546).Result.Dump();
return;
var letters = "#ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
var allTasks = letters.Select(i => GetProductsFor(i.ToString())).ToArray();
Task.WaitAll(allTasks);
var allData = allTasks.SelectMany (t => t.Result).ToList();
allData.Dump();
@jorupp
jorupp / dumpaccessibility.js
Created July 23, 2015 20:53
dumps out the name and heading of the accessibility test rules
$.getScript('https://rawgit.com/GoogleChrome/accessibility-developer-tools/master/dist/js/axs_testing.js', function() {
for (var k in axs.AuditRules.specs) { console.log(k, axs.AuditRules.specs[k].heading); }
});
@jorupp
jorupp / debug.js
Created July 24, 2015 13:14
Dumps out some information about a passed angular scope and it's connectivity to parents up the tree to the root
function debugScope(scope) {
function isInParent(scope) {
var parent = scope.$parent;
if(!parent) return false;
var s = parent.$$childHead;
while(s) {
if(s == scope) return true;
s = s.$$nextSibling;
}
return false;
@jorupp
jorupp / MultiTenant.cs
Created July 5, 2016 16:08
ASP.Net AzureAD Authentication Startup.Auth.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.IdentityModel.Claims;
using System.IdentityModel.Tokens;
using System.Threading.Tasks;
using System.Web;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
@jorupp
jorupp / gitStatus.cs
Created May 19, 2017 14:23
Find all git repos under a directory and check what branches they have that aren't merged into origin/master
string target = ".git";
string[] ignored = new [] { "node_modules", "bower_components" };
void Main()
{
var start = @"c:\projects";
var maxDepth = 4;
var dirs = Scan(start, maxDepth).ToList();
var results = dirs.AsParallel().Select(i => new { dir = i, data = GitStatus(i) }).ToDictionary(i => i.dir, i => i.data);
results.Dump();
}

Setup notes for Windows 11

This is how I got https://github.com/facebookresearch/llama working with Llama2 on a Windows 11 machine with a 4080 (16GB VRAM).

  1. Download a modern version of wget (with support for TLS 1.2) - ie. https://eternallybored.org/misc/wget/
  2. (if necessary) Modify download.sh to call your version of wget instead of the default one.
  3. Run ./download.sh via Git Bash and give it the URL from your email (it should start with https://download.llamameta.net, not https://l.facebook.com/). Warning: the 70B parameter models are big - figure 2GB to download per 1B parameters.
  4. Create a virtual environment - python -m venv .venv
  5. Activate virtual environment - . .\.venv\scripts\Activate.ps1
  6. Install prereqs - pip install -r requirements.txt