Skip to content

Instantly share code, notes, and snippets.

View jakecyr's full-sized avatar

Jake Cyr jakecyr

View GitHub Profile
@jakecyr
jakecyr / mixtral.bpe
Created March 21, 2024 17:26
Mixtral BPE
<unk>== 0
<s>== 1
</s>== 2
<0x00>== 3
<0x01>== 4
<0x02>== 5
<0x03>== 6
<0x04>== 7
<0x05>== 8
<0x06>== 9
@jakecyr
jakecyr / main.py
Created May 19, 2023 19:25
A Python script to load all videos from a YouTube playlist and delete them from the playlist. Requires OAuth client_secrets.json file from the console.
import google_auth_oauthlib.flow
import googleapiclient.discovery
import googleapiclient.errors
def get_authenticated_service():
scopes = ["https://www.googleapis.com/auth/youtube"]
flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(
"client_secrets.json", scopes
@jakecyr
jakecyr / updates.md
Created March 23, 2023 04:18
Python Semantic Release with Sphinx (GPT-4 Generated)

To include the CHANGELOG.md file in your Sphinx documentation, you can use the m2r2 extension to convert the Markdown file to reStructuredText format, which Sphinx can process.

First, install the m2r2 package by adding it to your pyproject.toml file:

[build-system]
requires = [
    # ... other dependencies ...
    "m2r2"
]
@jakecyr
jakecyr / .gitlab-ci.yml
Last active March 23, 2023 04:23
Python Semantic Release
image: python:3.9
stages:
- build
- test
- release
- sphinx
variables:
NEXUS_URL: "https://your-nexus-url.com"
const { SetCallback, TriggerCallback } = require('./index');
SetCallback(() => {
console.log('hello world');
});
TriggerCallback();
// 'hello world' is logged
#include <napi.h>
Napi::ThreadSafeFunction threadSafeCallback;
bool callbackWasSet = false;
Napi::String SetCallback(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
if (info.Length() < 1) {
throw Napi::Error::New(env, "Missing argument");
Napi::String TriggerCallback(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
if (!callbackWasSet) {
throw Napi::Error::New(env, "Callback was never set");
}
Napi::String napiMessageString = info[0].As<Napi::String>();
auto callback = [napiMessageString](Napi::Env env, Napi::Function jsCallback) {
#include <napi.h>
Napi::ThreadSafeFunction threadSafeCallback;
bool callbackWasSet = false;
Napi::String SetCallback(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
if (info.Length() < 1) {
throw Napi::Error::New(env, "Missing argument");
@jakecyr
jakecyr / App.tsx
Created December 5, 2020 03:04
Todo App.tsx with Navigator
import React from 'react';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import { rootReducer } from './store/rootReducer';
import { createStackNavigator } from '@react-navigation/stack';
import { NavigationContainer } from '@react-navigation/native';
import Home from './pages/Home';
import Detail from './pages/Detail';
const store = createStore(rootReducer);
@jakecyr
jakecyr / Detail.tsx
Created December 5, 2020 03:03
Todo Detail Page
import React from 'react';
import { Text, View } from 'react-native';
import { Todo } from '../store/todo/model';
import { selectCurrentTodo, selectTodos } from '../store/todo/selectors';
export default () => {
const todo: Todo | undefined = selectCurrentTodo();
return (
<View>