Skip to content

Instantly share code, notes, and snippets.

View clsource's full-sized avatar
💻
🥷🏼

Camilo clsource

💻
🥷🏼
View GitHub Profile
@zachdaniel
zachdaniel / libraries_and_frameworks.md
Last active June 29, 2023 16:42
EEF Working Group Proposal: Libraries and Frameworks Working Group

Libraries and Frameworks Working Group

Mission Statement

  • To provide resources for library and framework authors to ensure that BEAM languages have a rich, vibrant ecosystem with a high degree of developer experience. Main Objectives
  • Provide and maintain best practices on library and framework standardization, documentation, code, and distribution. Collaborate to work on and make proposals for underlying tooling that improve the experience for library/framework authors and users.
  • Provide more visibility into the library ecosystem of Elixir on behalf of both authors and users.
  • (if Build and Packaging want to move this here, we could also take this over) Improve the user experience in generating and accessing documentation from the shell, IDEs, web pages, and more.
@sorentwo
sorentwo / start_oban_web.livemd
Created July 27, 2022 16:38
Single Page Oban Web

Single Page Oban Web

Application.put_env(:sample, Sample.Repo, database: "oban_dev")

Application.put_env(:phoenix, :json_library, Jason)

Application.put_env(:sample, Sample.Endpoint,
  http: [ip: {127, 0, 0, 1}, port: 5001],
  server: true,
@Eleven-am
Eleven-am / phœnix-channels-react-hook.tsx
Last active August 15, 2022 09:39
This is a relatively typed phoenix channels hook that works incredibly well with react. you can create the same channels in multiple components as they share the same channel singleton
import {
createContext,
ReactNode,
useCallback,
useContext,
useEffect, useMemo,
useRef,
useState
} from "react";
import {Channel, Presence, Socket} from "phoenix";

Creating a .so dynamic library of a haskell program and calling it from C

TLDR:

  • Export a haskell function with foreign export.
  • Create a C wrapper that calls hs_init when the library is loaded.
  • Compile the .hs and .c wrapper with ghc, linking with lHSrts-ghc8.6.5
  • Use it from C by linking as usual.

(For more details, see here.)

@hollowmaster1496
hollowmaster1496 / msys2-shortcut.md
Last active June 6, 2024 10:34
Open MSYS2 terminal here (mingw-w64) from right-click menu

For anyone who develops software on Windows (but needs quick access to a Linux terminal), here's a quick and easy way to get it with MSYS2.

Before starting, install "MSYS2" with default settings.

  1. From Windows search, launch 'regedit.exe'
  2. Navigate to "HKEY_CLASSES_ROOT\Directory\Background\shell"
  3. Right-click on 'shell' and select New>Key. Call this key MSYS2.
  4. Now right-click on 'MSYS2' and select New>Key. Call this key command
  5. Select command and then double-click on (Default). Set 'Value data' to "C:\msys64\msys2_shell.cmd" "-here"
@Pigu-A
Pigu-A / dmf2ds24.py
Last active January 8, 2022 17:30
Deflemask module (.dmf) to DevSound 2.4 converter. Not all features are converted correctly.
import io, string, sys, zlib
CH3_DMF_VOL_IS_DS_VOL = False
def sane(a):
cap = True
t = ""
for i in a.decode():
if i in string.ascii_letters + string.digits + "_":
t += i.upper() if cap else i
cap = False
@cute
cute / JavaScriptCore+fetch.swift
Created April 26, 2019 22:59 — forked from yycking/JavaScriptCore+fetch.swift
add fetch, console.log and Promise.then/catch to JavaScriptCore on iOS/Mac
import JavaScriptCore
extension JSContext {
subscript(key: String) -> Any {
get {
return self.objectForKeyedSubscript(key)
}
set{
self.setObject(newValue, forKeyedSubscript: key as NSCopying & NSObjectProtocol)
}
@dhkatz
dhkatz / msys2-visual-studio-code.md
Last active June 23, 2024 22:09
Using MSYS2 with Visual Studio Code

Using MSYS2 with Visual Studio Code is extremely easy now thanks to the Shell Launcher extension by Tyriar.

First, install the extension and reload Visual Studio Code.

Then, open the settings.json to edit your settings.

Add the field shellLauncher.shells.windows. I recommend using autocompletion here so that all the default shells are added.

You should having something like this now:

@jsomers
jsomers / websockets.md
Created September 27, 2018 12:50
Using websockets to easily build GUIs for Python programs

Using websockets to easily build GUIs for Python programs

I recently built a small agent-based model using Python and wanted to visualize the model in action. But as much as Python is an ideal tool for scientific computation (numpy, scipy, matplotlib), it's not as good for dynamic visualization (pygame?).

You know what's a very mature and flexible tool for drawing graphics? The DOM! For simple graphics you can use HTML and CSS; for more complicated stuff you can use Canvas, SVG, or WebGL. There are countless frameworks, libraries, and tutorials to help you draw exactly what you need. In my case, this was the animation I wanted:

high-priority

(Each row represents a "worker" in my model, and each rectangle represents a "task.")

@markblundeberg
markblundeberg / pgp-checkdatasig.md
Created August 31, 2018 01:23
Using PGP signatures with bitcoin script OP_CHECKDATASIG

Using PGP signatures with bitcoin script OP_CHECKDATASIG

Dr. Mark B. Lundeberg, 2018 August 30 bitcoincash:qqy9myvyt7qffgye5a2mn2vn8ry95qm6asy40ptgx2

Since version 2.1, GnuPG is able to use the very same secp256k1 elliptic curve signature algorithm (ECDSA) as used in bitcoin. Quite soon Bitcoin Cash will add a new script opcode OP_CHECKDATASIG that is able to check signatures not just on the containing transaction, but also on arbitrary data. For fun, let's try to intersect the two signature systems and see what can be done!

Background

OP_CHECKDATASIG signatures