Skip to content

Instantly share code, notes, and snippets.

@acrolink
acrolink / flutter_chat_channel.ex
Created November 1, 2024 20:16
Example of a LangChain Channel definition for use with a Flutter client (using Phoenix Wings for Dart)
defmodule ServerWeb.FlutterChatChannel do
use ServerWeb, :channel
alias ServerWeb.Chatbot.ChatMessage
alias LangChain.Chains.LLMChain
alias LangChain.Message
alias LangChain.Message.ToolCall
alias LangChain.Message.ToolResult
alias LangChain.ChatModels.ChatOpenAI
alias LangChain.PromptTemplate
@acrolink
acrolink / make-wg-client.sh
Created April 22, 2023 16:36 — forked from pR0Ps/make-wg-client.sh
Script to generate wireguard configs for clients to allow them to connect to the local wireguard server
#!/bin/bash
#######
# Setup
#######
### Enable IPv4/6 forwarding:
# # In /etc/sysctl.d/30-ipforward.conf :
# net.ipv4.ip_forward=1
# net.ipv6.conf.default.forwarding=1
# net.ipv6.conf.all.forwarding=1
@acrolink
acrolink / my_excel.module.php
Created November 28, 2021 12:14
sms_sender/sites/all/modules/my_excel/my_excel.module [PHP]
<?php
function my_excel_permission()
{
return array(
'Use Excel API' => array(
'title' => t('Use Excel API'),
'description' => t(''),
),
);
@acrolink
acrolink / borrower_controller.ex
Last active November 28, 2021 12:16
/libsys/backend/mango_web/controllers/borrower_controller.ex [Elixir]
defmodule MangoWeb.BorrowerController do
use MangoWeb, :controller
use MangoWeb.ExtendController
alias Mango.Borrowers
alias Mango.Borrowers.Borrower
alias Mango.Repo
import Ecto.Query
@acrolink
acrolink / store.js
Created November 28, 2021 12:05
/libsys/frontend/src/store.js [vue]
import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import * as Cookies from 'js-cookie'
Vue.use(Vuex)
export default new Vuex.Store({
plugins: [
@acrolink
acrolink / BorrowerForm.vue
Created November 28, 2021 12:01
/libsys/frontend/src/components/BorrowerForm.vue [vue]
<template>
<sweet-modal ref="edit_borrower_modal">
<h2>{{borrower.id != null ? $t('edit_student') : $t('create_new_student')}}</h2>
<div class="form-group">
<label for="editor_name">{{$t('name')}}</label>
<input id="editor_name" v-model="borrower.name" placeholder="" class="form-control">
</div>
<div class="form-group">
'use strict';
var _ = require('lodash');
var Storage = require('./storage.model');
var ProcductLifeCycle = require('../product/product.model').ProductLifeCycle;
var async = require('async');
// Get list of storages
exports.index = function (req, res) {
'use strict';
var _ = require('lodash');
var Docxtemplater = require('docxtemplater');
var ImageModule = require('docxtemplater-image-module');
var fs = require('fs');
var util = require('util');
var path = require('path');
var async = require('async');
@acrolink
acrolink / index.html
Created March 1, 2018 21:17 — forked from TahaSh/index.html
Reusable Autocomplete-Input Component in Vue 2.1
<title>Vue Awesome Autocomplete</title>
<link rel="stylesheet" href="https://unpkg.com/bulma/css/bulma.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="style.css">
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div id="app">
<autocomplete-input
:options="options"
@select="onOptionSelect"
@acrolink
acrolink / index.html.eex
Last active January 4, 2017 11:28
Filtering results in Phoenix using an exposed filters' form
<h2>Listing policies</h2>
<form action="/policies" method="get">
<%= select nil, :client_id, @clients, name: 'client_id' %>
<input type="submit" value="Submit">
</form>
<%= pagination_links @page %>
<!-- HTML displaying the data rows -->