Skip to content

Instantly share code, notes, and snippets.

@rylev
rylev / learn.md
Created March 5, 2019 10:50
How to Learn Rust

Learning Rust

The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.

Warning

Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.

The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.

# this tutorial assumes conda and git are both installed on your computer
conda create -n tg python=3.10.9
conda activate tg
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
git clone https://github.com/oobabooga/text-generation-webui.git
cd text-generation-webui
pip install -r requirements.txt
# GPU only:
@jackhftang
jackhftang / answer1.md
Last active May 6, 2024 19:44
Oursky Developer Pre-Test

Question 1

Write a function that takes two arrays as input, each array contains a list of A-Z; Your program should return True if the 2nd array is a subset of 1st array, or False if not.

For example: isSubset([A,B,C,D,E], [A,E,D]) = true isSubset([A,B,C,D,E], [A,D,Z]) = false isSubset([A,D,E], [A,A,D,E]) = true

@mattiasgustavsson
mattiasgustavsson / gist:b97e9e59e5e1742dcabff60179fcda67
Created April 7, 2022 14:13
Simple string allocation system, allowing for freeing all allocated strings in one go
#define STR_NEW( pool, str ) ( pool = memcpy( (char*) memcpy( malloc( ( str ? strlen( str ) : 0 ) + 1 + \
sizeof( char* ) ), &pool, sizeof( char* ) ) + sizeof( char*), str ? str : "", ( str ? strlen( str ) : 0 ) + 1 ) )
#define STR_FREE( pool ) while( pool ) { char* STR_FREE_TMP = ( pool - sizeof( char* ) ); \
pool = ( *(char**)STR_FREE_TMP ); free( STR_FREE_TMP ); }
//---------------------------
char* strpool = NULL;
@zkiraly
zkiraly / procedure-to-archive-git-branches.md
Last active May 6, 2024 19:42
Procedure to archive git branches.
// npm install --save scrollreveal or install like you're used to doing it.
// It doesn't work well if there are multiple instances of ScrollReveal,
// so we have to create a module returning an instance:
// file ScrollReveal.js:
import ScrollReveal from 'scrollreveal'
export default ScrollReveal()
// Then in a component:
import React from 'react'
import sr from './ScrollReveal'
@tomconder
tomconder / reset.css
Created May 6, 2024 19:39
A reset stylesheet is to reduce browser inconsistencies
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@riffrain
riffrain / build and install.sh
Created January 12, 2020 01:47
build neovim and install it to local
git clone https://github.com/neovim/neovim
cd neovim
# if you want build stable release
git checkout stable
make CMAKE_BUILD_TYPE=Release \
CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$HOME/.local -DLibIntl_LIBRARY=/usr/lib/libintl.so.8 -DLibIntl_INCLUDE_DIR=/usr/include"
make install
# export PATH="$HOME/.local/bin:$PATH"
@copyrat90
copyrat90 / butano-vscode-cpptools.md
Last active May 6, 2024 19:41
Setup intellisense for Butano project with VSCode C/C++ extension

Setup intellisense for Butano project with VSCode C/C++ extension

  1. Install C/C++ extension for VSCode
  2. Copy the snippet below, and paste it as <yourProjectRoot>/.vscode/c_cpp_properties.json
  3. Change the line "<yourPathToButano>/butano/include", to your location of Butano
    • For example, if you installed Butano to the C:/butano, it should be "C:/butano/butano/include",

Note

@shaneutt
shaneutt / LICENSE
Last active May 6, 2024 19:40
Golang: Demonstrate creating a CA Certificate, and Creating and Signing Certs with the CA
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit