Skip to content

Instantly share code, notes, and snippets.

@yigiteren
yigiteren / MeshCombiner.cs
Created October 21, 2021 09:54
A mesh combining example for Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MeshCombiner : MonoBehaviour
{
[SerializeField] private List<MeshFilter> sourceMeshFilters;
[SerializeField] private MeshFilter targetMeshFilter;
[ContextMenu("Combine Meshes")]
@Quiark
Quiark / sandbox.h
Created January 2, 2020 07:00
restricted version of sbtool that is compilable
// courtesy of clang
// https://github.com/applesrc/clang/blob/bb8f644/src/projects/compiler-rt/lib/sanitizer_common/sanitizer_mac_spi.cc
enum sandbox_filter_type {
SANDBOX_FILTER_NONE,
SANDBOX_FILTER_PATH,
SANDBOX_FILTER_GLOBAL_NAME,
SANDBOX_FILTER_LOCAL_NAME,
SANDBOX_FILTER_APPLEEVENT_DESTINATION,
@hopsoft
hopsoft / db.rake
Last active May 6, 2024 14:00
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@styblope
styblope / docker-api-port.md
Last active May 6, 2024 14:00
Enable TCP port 2375 for external connection to Docker

Enable TCP port 2375 for external connection to Docker

See this issue.
Docker best practise to Control and configure Docker with systemd.

  1. Create daemon.json file in /etc/docker:

     {"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}
    
# IDA (disassembler) and Hex-Rays (decompiler) plugin for Apple AMX
#
# WIP research. (This was edited to add more info after someone posted it to
# Hacker News. Click "Revisions" to see full changes.)
#
# Copyright (c) 2020 dougallj
# Based on Python port of VMX intrinsics plugin:
# Copyright (c) 2019 w4kfu - Synacktiv
@SwiftyAlex
SwiftyAlex / squishybuttonthing.swift
Created April 20, 2024 15:20
squishybuttonthing
// Credit to Raffi for the design! https://twitter.com/raffichill/status/1781492309500027206
struct SquishyButtonThing: View {
@State var expanded: Bool = false
var body: some View {
VStack {
Spacer()
VStack {
/* ~/Library/KeyBindings/DefaultKeyBinding.dict
* Created by VerityJ
*/
{
"$\U007F" = "deleteForward:";
/* 'shift - delete' as forward delete - works in Xcode, not in Terminal */
"\UF708" = "deleteForward:";
@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)