Skip to content

Instantly share code, notes, and snippets.

@mathix420
mathix420 / medium.user.js
Last active April 19, 2024 14:09
Bypass Medium Paywall - Working late 2023 - Greasy Fork, Violentmonkey, Tampermonkey - Click the RAW button to install
// ==UserScript==
// @name Medium Paywall Bypass
// @namespace Violentmonkey Scripts
// @run-at document-start
// @match *://*.medium.com/*
// @match *://medium.com/*
// @match *://*/*
// @grant none
// @version 2.3
// @inject-into content
@scriptdev
scriptdev / .php
Last active April 19, 2024 14:09
ATRIBUIR VALOR NO CAMPO DO FORMULÁRIO VIA JQUERY
<?php
TTransaction::open(self::$database);
$uf = Cidade::find($param['key'])->uf;
if ($uf) { TScript::create(" $('#uf').val('$uf') "); }
TTransaction::close();
@cedrickchee
cedrickchee / llama-7b-m1.md
Last active April 19, 2024 14:08
4 Steps in Running LLaMA-7B on a M1 MacBook with `llama.cpp`

4 Steps in Running LLaMA-7B on a M1 MacBook

The large language models usability

The problem with large language models is that you can’t run these locally on your laptop. Thanks to Georgi Gerganov and his llama.cpp project, it is now possible to run Meta’s LLaMA on a single computer without a dedicated GPU.

Running LLaMA

There are multiple steps involved in running LLaMA locally on a M1 Mac after downloading the model weights.

@scriptdev
scriptdev / .php
Last active April 19, 2024 14:07
ADICIONAR IMAGEM BASE64 NO TImage VIA JAVASCRIPT
<?php
public function onImagemBase64($param = null)
{
try
{
$base64 = "iVBORw0KGgoAAAANSUhEUgAAAfMAAAHyCAMAAADIjdfcAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZS.........';
$js = "
var imagem = 'data:image/png;base64,{$base64}';
@rphlmr
rphlmr / clear-db.ts
Last active April 19, 2024 14:06
Drizzle snippets
// Credits to Louistiti from Drizzle Discord: https://discord.com/channels/1043890932593987624/1130802621750448160/1143083373535973406
import { sql } from "drizzle-orm";
const clearDb = async (): Promise<void> => {
const query = sql<string>`SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_type = 'BASE TABLE';
`;
@Klerith
Klerith / flutter-instalaciones.md
Last active April 19, 2024 14:06
Instalaciones del curso de Flutter - Móvil de cero a experto
@scriptdev
scriptdev / .php
Last active April 19, 2024 14:05
IMPORTAÇÃO DA PLANILHA EXCEL "xls" (SimpleXLSX)
<?php
# PRIMEIRO, INSTALE VIA COMPOSER: shuchkin/simplexlsx
# DEPOIS FAÇA A REFERẼNCIA DA CLASSE CONTROLLER ONDE VOCÊ DESEJA USAR A BIBLIOTECA:
use Shuchkin\SimpleXLSX;
class ImportacaoExcel extends TPage
{
@scriptdev
scriptdev / .php
Last active April 19, 2024 14:04
CALCULAR A IDADE
<?php
public static function onDataNascimento($param = null)
{
try
{
# CALCULA A IDADE
$data_nascimento = TDate::date2us($param['data_nascimento']);
$data = new DateTime($data_nascimento);
$resultado = $data->diff(new DateTime(date('Y-m-d')));
@maxcal
maxcal / gist:2947417
Created June 18, 2012 08:08
Simple Curl web scraper
<?php
/**
* @param string $url - the url you wish to fetch.
* @return string - the raw html respose.
*/
function web_scrape($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($ch);
@rogerallen
rogerallen / us_state_abbrev.py
Last active April 19, 2024 14:04
A Python Dictionary to translate US States to Two letter codes
# United States of America Python Dictionary to translate States,
# Districts & Territories to Two-Letter codes and vice versa.
#
# Canonical URL: https://gist.github.com/rogerallen/1583593
#
# Dedicated to the public domain. To the extent possible under law,
# Roger Allen has waived all copyright and related or neighboring
# rights to this code. Data originally from Wikipedia at the url:
# https://en.wikipedia.org/wiki/ISO_3166-2:US
#