Skip to content

Instantly share code, notes, and snippets.

@pcuenca
pcuenca / openelm-coreml.py
Created April 30, 2024 09:55
Convert OpenELM to Core ML (float32)
import argparse
import numpy as np
import torch
import torch.nn as nn
import coremltools as ct
from transformers import AutoTokenizer, AutoModelForCausalLM
# When using float16, all predicted logits are 0. To be debugged.
compute_precision = ct.precision.FLOAT32
compute_units = ct.ComputeUnit.CPU_ONLY
@jmceleney
jmceleney / xiaomi-enable-mesh-telnet.py
Last active May 6, 2024 13:54
Python3 file that enables netmode4 on a Xiaomi RB01 AX3200 router
import ssl
import socket
# This script simply replays one side of an intercepted conversation between two Xiaomi
# RB01 (International) AX3200 routers negotiating meshing.
# In effect the script poses as a mesh slave, which causes the mesh master to enable netmode4.
# Enabling netmode is needed as one step in unlocking the router and flashing OpenWrt.
# The router should already have been taken through basic set-up before running this script.
# Netmode4 can be confirmed with curl by requesting the following URL, where ${token} is the "stok"
# variable from your admin session:
@basnijholt
basnijholt / cto_line.pine
Created September 18, 2021 08:23
CTO Line indicator for TradingView
//@version=4
study(title="CTO Line", shorttitle="CTO", overlay=true, resolution="")
smma(src, length) =>
smma = 0.0
smma := na(smma[1]) ? sma(src, length) : (smma[1] * (length - 1) + src) / length
smma
v1 = smma(hl2, 15)
m1 = smma(hl2, 19)
m2 = smma(hl2, 25)
v2 = smma(hl2, 29)
@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active May 6, 2024 13:53
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@luizomf
luizomf / settings.json
Created October 24, 2022 13:01
Configuração inicial do VS Code
{
"window.zoomLevel": 2,
"workbench.startupEditor": "none",
"explorer.compactFolders": false,
"workbench.iconTheme": "material-icon-theme",
"editor.fontSize": 18,
"workbench.colorTheme": "OM Theme (Default Dracula Italic)",
"code-runner.executorMap": {
"python": "clear ; python -u",
},
@philcampbell-qhr
philcampbell-qhr / cities.txt
Created January 8, 2020 22:51
list of cities/towns in Canada
100 Mile House, British Columbia
108 Mile House, British Columbia
108 Mile Ranch, British Columbia
150 Mile House, British Columbia
Abbey, Saskatchewan
Abbotsford, British Columbia
Aberarder, Ontario
Abercorn, Quebec
Aberdeen, Saskatchewan
Abernethy, Saskatchewan
@BSVArchie
BSVArchie / leaflet.html
Created May 6, 2024 13:47 — forked from afomi/leaflet.html
Simple Leaflet.js Map Example
<html>
<head>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
<style>
#map { height: 500px; }
@lukebrandonfarrell
lukebrandonfarrell / ExifData.swift
Created June 8, 2022 16:10
A Swift class for extracting exif data from URL, UIImage or Data types 🔭
//
// ExifData.swift
// Qeepsake
//
// Created by Luke Farrell on 26/05/2022.
//
import Foundation
import ImageIO
version: '3'
services:
traefik:
image: traefik:v2.0
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
@dragonfire1119
dragonfire1119 / TTS HomeAssistant
Last active May 6, 2024 13:45
Home Assistant TTS to homepods
service: tts.cloud_say
data:
entity_id: media_player.christophers_homepod
cache: true
language: en-US
message: This is Christopher's HomePod Playing on Nabacasa
enabled: true