Skip to content

Instantly share code, notes, and snippets.

View jbochi's full-sized avatar

Juarez Bochi jbochi

View GitHub Profile
@jbochi
jbochi / gguf.md
Created January 21, 2024 21:20
sentence piece model from gguf
from gguf.gguf_reader import GGUFReader
def get_string_array_field(gguf_reader: GGUFReader, key: str):
    f = gguf_reader.get_field(key)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/bash
#
# (1) copy to: ~/bin/ssh-host-color
# (2) set: alias ssh=~/bin/ssh-host-color
#
# Inspired from http://talkfast.org/2011/01/10/ssh-host-color
# Fork from https://gist.github.com/773849
#
set_term_bgcolor(){
@jbochi
jbochi / coroutine_lua.c
Created March 16, 2014 17:35
Como "pausar/suspender" execução código C com corotina Lua
#include <stdio.h>
#include <string.h>
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
double arg;
static int l_csleep_cont (lua_State *L) {
@jbochi
jbochi / listener.clj
Created November 30, 2013 21:52
chat com clojure, core.async e zeromq
(require '[com.keminglabs.zmq-async.core :refer [register-socket!]]
'[clojure.core.async :refer [>! <! <!! >!! go chan sliding-buffer close!]])
(let [addr "tcp://*:9999"
[s-in s-out] (repeatedly 2 #(chan (sliding-buffer 64)))]
(register-socket! {:in s-in :out s-out :socket-type :rep
:configurator (fn [socket] (.bind socket addr))})
(println "waiting messages...")
@jbochi
jbochi / problema1.matlab
Last active December 28, 2015 04:18
Problema de transporte - Otimizacao Combinatoria - http://www-di.inf.puc-rio.br/~poggi/oc112-lf1.pdf
c = [5, 10, 7, 8, 9, 6]';
A = [1, 1, 1, 0, 0, 0; 0, 0, 0, 1, 1, 1; 1, 0, 0, 1, 0, 0; 0, 1, 0, 0, 1, 0; 0, 0, 1, 0, 0, 1];
b = [15, 25, 15, 15, 10]';
lb = [0, 0, 0, 0, 0, 0];
ub = [];
vartype = "CCCCCC";
ctype = "SSSSS";
sense = 1;
@jbochi
jbochi / gist:7278823
Created November 2, 2013 13:19
c1-medium
root@master:~# sudo lshw
master
description: Computer
width: 64 bits
capabilities: vsyscall32
*-core
description: Motherboard
physical id: 0
*-memory
description: System memory
Port 8081
BindAddress 0.0.0.0
MaxClients 10
MaxBandwidth 50000
NoDaemon
<Feed feed.ffm>
file /tmp/feed.ffm
FileMaxSize 20M
</Feed>
@jbochi
jbochi / monitor.py
Created July 9, 2013 16:25
Script to monitor an URL for changes
import urllib
from time import sleep
from hashlib import md5
import sys
def bell():
sys.stdout.write('\a')
sys.stdout.flush()
def dig():
@jbochi
jbochi / slow.py
Created July 5, 2013 19:52
slow pipe
import sys
import time
delay = float(sys.argv[1])
for line in sys.stdin:
sys.stdout.write(line)
time.sleep(delay)