Skip to content

Instantly share code, notes, and snippets.

View contactsamie's full-sized avatar

Sam 塞缪尔 contactsamie

  • “I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.”
  • Vancouver, BC
View GitHub Profile
# Make sure you have Anaconda installed
# This tutorial assumes you have an Nvidia GPU, but you can find the non-GPU version on the Textgen WebUI github
# More information found here: https://github.com/oobabooga/text-generation-webui
conda create -n textgen python=3.10.9
conda activate textgen
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
git clone https://github.com/oobabooga/text-generation-webui
cd text-generation-webui
python -m pip install -r requirements.txt
using System;
using System.Diagnostics;
using System.IO;
public interface IHtmlToPdfConverter
{
byte[] Convert(string basePath, string htmlCode, FormatType formatType, OrientationType orientationType);
}
public class HtmlToPdfConverter : IHtmlToPdfConverter
@contactsamie
contactsamie / gist:26e9b850f95e2b443872c9e8220c91e1
Created August 19, 2020 20:57 — forked from learncodeacademy/gist:8acf7e3a2c4c33100f04c6715c662a01
Training a Neural Network - Enhanced Console Output From Brain.js
Start Training!...Here's the data, we'll do 2 iterations:
[ { input: [ 0, 1 ], output: [ 1, 0 ] },
{ input: [ 1, 1 ], output: [ 1, 1 ] } ]
======== TRAINING ITERATION 1 =========
--------- Run input set 0: 0,1 ----------
-> Layer 2 has 3 nodes
START NODE: 0
-> bias for node 0: 0.13861538469791412
-> weights for node 0:
-> input value: 0, weight: -0.03485306352376938
@contactsamie
contactsamie / all-angular-material-components-imports.txt
Created May 17, 2020 20:40 — forked from pimatco/all-angular-material-components-imports.txt
All Angular Material Components Imports from app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
//Angular Material Components
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {MatCheckboxModule} from '@angular/material';
import {MatButtonModule} from '@angular/material';
@contactsamie
contactsamie / DocStore.cs
Created May 13, 2020 09:47 — forked from mouhong/DocStore.cs
RavenDB Multi-Map/Reduce VisitSummaryByDateIndex
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Raven.Client;
using Raven.Client.Document;
using Raven.Client.Indexes;
namespace RavenTest
{
@contactsamie
contactsamie / DocStore.cs
Created May 13, 2020 09:47 — forked from mouhong/DocStore.cs
RavenDB Multi-Map/Reduce VisitSummaryByDateIndex
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Raven.Client;
using Raven.Client.Document;
using Raven.Client.Indexes;
namespace RavenTest
{
@contactsamie
contactsamie / Web.config
Created October 25, 2018 03:20 — forked from alexsorokoletov/Web.config
Web.config for Azure App Services/Web Sites to allow downloading static files (withouth extension) for Electron autoupdate
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension="." mimeType="text/plain" />
<mimeMap fileExtension=".nupkg" mimeType="application/octet-stream" />
<mimeMap fileExtension=".exe" mimeType="application/octet-stream" />
<mimeMap fileExtension=".zip" mimeType="application/x-zip-compressed" />
</staticContent>
</system.webServer>
@contactsamie
contactsamie / redis.sh
Created June 9, 2017 14:48 — forked from luishdez/redis.sh
Redis lua scripts Update Set and Sorted Set only if the value / score is higher or lower …
# Basic benchmarks
# SET key val # 87489.06
# SETRANGE key2 6 "Redis" # 75757.58 req/s
# INCR key 245 # 70224.72 req/s
# INCRBY key 245 22 # 67114.09 req/s
# EVAL SET key val # 46296.29 req/s
# SETIFHIGHER (set or update key if new value is higher than current) # 41666.67 req/s
# if not exists return OK , if updated return the increment , if not updated return 0
SCRIPT LOAD "local c = tonumber(redis.call('get', KEYS[1])); if c then if tonumber(ARGV[1]) > c then redis.call('set', KEYS[1], ARGV[1]) return tonumber(ARGV[1]) - c else return 0 end else return redis.call('set', KEYS[1], ARGV[1]) end"