Skip to content

Instantly share code, notes, and snippets.

@gngchrs
gngchrs / compose.yaml
Last active February 9, 2024 13:22
Ollama Web UI and Tailscale with https. The config file below goes in your config/config.json. Once you have these files do `docker compose up` and go to `https://ollama-ui.<tailnet>.ts.net. First request will take a little longer to load`
services:
ts-ollama-ui:
image: tailscale/tailscale:latest
container_name: ts-ollama-ui
hostname: ollama-ui # http://ollama-ui.<tailnet>.ts.net
extra_hosts:
- "host.docker.internal:host-gateway" # important for ollama web ui to communicate with ollama running locally
environment:
- TS_AUTHKEY=<YOUR_OAUTH_KEY / YOUR_AUTH_KEY >
- "TS_EXTRA_ARGS=--advertise-tags=tag:container --reset" ## only needed if you use YOUR_OAUTH_KEY with owner tags
@gngchrs
gngchrs / keybase.md
Last active November 10, 2021 10:23

Keybase proof

I hereby claim:

  • I am gngchrs on github.
  • I am ganga (https://keybase.io/ganga) on keybase.
  • I have a public key ASB7GtPQJQf0r5N4bPu_kANfTtYd0jftXQf1mI92-IM4_go

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am gangachris on github.
  • I am ganga (https://keybase.io/ganga) on keybase.
  • I have a public key ASCzHpSV-RbN63mksj5o3c6wcD2h6K4N2aOr5IW4KMkligo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am gangachris on github.
  • I am ganga (https://keybase.io/ganga) on keybase.
  • I have a public key whose fingerprint is B36F FABA 3B58 5076 13EA DAA5 255C 5FDB BF1F 4395

To claim this, I am signing this object:

@gngchrs
gngchrs / scan.go
Last active December 12, 2018 13:24
f, err := os.Open("salary.txt")
if err != nil {
log.Fatal(err)
}
defer f.Close()
var xs []float64
scan := bufio.NewScanner(f)
for scan.Scan() {
var v float64
@gngchrs
gngchrs / car_exchange.sol
Last active May 10, 2018 17:22
Solution to Introduction to Solidity Scenario Example https://gangachris.com/posts/introduction-to-solidity/
pragma solidity ^0.4.20;
contract Cars {
// we declare a custom type car
struct Car {
bytes32 make;
uint year;
}
// we create a map that takes ethereum address and maps them to a Cars array
@gngchrs
gngchrs / docker-compose.yaml
Created February 24, 2018 22:44
basic network hyperledger fabric docker-compose file
version: '2'
networks:
basic:
services:
ca.example.com:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
@gngchrs
gngchrs / handshake.js
Created March 7, 2017 10:55
Given x handshakes, get the number of guests in a meeting, and assuming each guest made a handshake to each other guest once. Get the number of guests. Common aptitude problem
// After studying the problem, you'll see an arithemetic progression like pattern
// Using the sum of arithmetic progression could easily work too.
// But on further inspection, it's a simple consectuive numbers problem.
function getConsecutiveDevisors(num) {
let lowerDevisor = Math.floor(Math.sqrt(num))
let higherDevisor = lowerDevisor + 1;
if (lowerDevisor * higherDevisor === num) {
return [lowerDevisor, lowerDevisor + 1]
}
@gngchrs
gngchrs / routes.php
Created July 12, 2016 07:34
Same Route Defining multiple controllers
<?php
Route::group(['middleware' => ['web', 'auth','adminMiddleware']], function () {
Route::get('/panel/home', 'UserAdminController@showAdminHome');
Route::get('/panel/home', 'UserRegionController@showAdminRegionHome');
Route::get('/panel/home', 'UserPlaceController@showAdminPlaceHome');
});
DB_HOST=database
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret