Skip to content

Instantly share code, notes, and snippets.

View magichim's full-sized avatar
๐ŸŽฏ
Focusing

Songwon Park magichim

๐ŸŽฏ
Focusing
View GitHub Profile
@Astro36
Astro36 / rust-ffi-tutorial.md
Last active May 22, 2023 11:15
Node.js์—์„œ FFI๋กœ Rust๋ฅผ ์ด์šฉํ•ด๋ณด์ž

Node.js์—์„œ FFI๋กœ Rust๋ฅผ ์ด์šฉํ•ด๋ณด์ž

์†Œ๊ฐœ

Rust๋Š” ์„ฑ๋Šฅ์ด ์šฐ์ˆ˜ํ•œ ๋กœ์šฐ ๋ ˆ๋ฒจ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค. ๋˜ํ•œ, ๋น„์šฉ ์—†๋Š” ์ถ”์ƒํ™”, ๋ฉ”๋ชจ๋ฆฌ ์•ˆ์ •์„ฑ, ๋ฐ์ดํ„ฐ ๋ ˆ์ด์Šค ์—†๋Š” ์Šค๋ ˆ๋”ฉ ๋“ฑ๋“ฑ์„ ์ง€์›ํ•˜๋ฉฐ C++์— ๋น„ํ•ด ๋ฌธ๋ฒ•๋„ ๊ฐ„๊ฒฐํ•ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์žฅ์ ์˜ Rust๋ฅผ Node์™€ ๊ฒฐํ•ฉ์‹œ์ผœ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด, Node์˜ ๋ถ€์กฑํ•œ ์„ฑ๋Šฅ์„ ๋ฉ”๊ฟ€ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Node์—์„œ Rust์—์„œ ์ž‘์„ฑํ•œ ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” FFI(Foreign function interface, ์™ธ๋ถ€ ํ•จ์ˆ˜ ์ธํ„ฐํŽ˜์ด์Šค)๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์•„๋ž˜๋Š” ์ค€๋น„๋ฌผ์ž…๋‹ˆ๋‹ค.

์ค€๋น„๋ฌผ

@bastienrobert
bastienrobert / README.md
Last active April 29, 2024 03:24
Script to open chrome with specific URL gived in params

OpenChrome

Inspired by Create React App

This script is checking in every chrome window if there's a tab with the URL gived in params:

  • If there's one: It opens chrome in first-ground and show the good chrome window with the good tab
  • If there's multiples: Same behavior but it use the first tab found
  • If there's not: It launch chrome (if it's not open) and create a new tab with the given URL

How it works

osascript openChrome.scpt YOUR_FORMATTED_URL

@faressoft
faressoft / dom_performance_reflow_repaint.md
Last active February 10, 2025 17:21
DOM Performance (Reflow & Repaint) (Summary)

DOM Performance

Rendering

  • How the browser renders the document
    • Receives the data (bytes) from the server.
    • Parses and converts into tokens (<, TagName, Attribute, AttributeValue, >).
    • Turns tokens into nodes.
    • Turns nodes into the DOM tree.
  • Builds CSSOM tree from the css rules.
@betweenbrain
betweenbrain / read-files.js
Created December 5, 2016 22:35
Node.js read multiple files, write into one
var fs = require('fs');
var Promise = require('promise');
var promises = [];
var readline = require('readline');
var readFile = function (file) {
return new Promise(function (resolve, reject) {
var lines = [];
var rl = readline.createInterface({
input: fs.createReadStream('./logs/' + file)
@michaellihs
michaellihs / tmux-cheat-sheet.md
Last active April 19, 2025 13:20
tmux Cheat Sheet
@Pusnow
Pusnow / ํ•œ๊ธ€๊ณผ์œ ๋‹ˆ์ฝ”๋“œ.md
Last active April 1, 2025 05:35
ํ•œ๊ธ€๊ณผ ์œ ๋‹ˆ์ฝ”๋“œ

ํ•œ๊ธ€๊ณผ ์œ ๋‹ˆ์ฝ”๋“œ

์œ ๋‹ˆ์ฝ”๋“œ์—์„œ ํ•œ๊ธ€์„ ์–ด๋–ป๊ฒŒ ๋‹ค๋ฃจ๋Š”์ง€๋ฅผ ์ •๋ฆฌํ•˜์˜€๋‹ค.

์œ ๋‹ˆ์ฝ”๋“œ

  • ์œ ๋‹ˆ์ฝ”๋“œ(Unicode)๋Š” ์ „ ์„ธ๊ณ„์˜ ๋ชจ๋“  ๋ฌธ์ž๋ฅผ ์ปดํ“จํ„ฐ์—์„œ ์ผ๊ด€๋˜๊ฒŒ ํ‘œํ˜„ํ•˜๊ณ  ๋‹ค๋ฃฐ ์ˆ˜ ์žˆ๋„๋ก ์„ค๊ณ„๋œ ์‚ฐ์—… ํ‘œ์ค€ (์œ„ํ‚ค ๋ฐฑ๊ณผ)
  • ๋‹จ์ˆœํžˆ ๋ฌธ์ž๋งˆ๋‹ค ๋ฒˆํ˜ธ๋ฅผ ๋ถ™์ž„
  • ๊ณ„์† ์—…๋ฐ์ดํŠธ๋˜๋ฉฐ ํ˜„์žฌ๋Š” Unicode Version 9.0.0 ์ด ์ตœ์‹ ์ด๋‹ค.

UTF

  • ์œ ๋‹ˆ์ฝ”๋“œ๋ฅผ ์‹ค์ œ ํŒŒ์ผ ๋“ฑ์— ์–ด๋–ป๊ฒŒ ๊ธฐ๋กํ•  ๊ฒƒ์ธ์ง€๋ฅผ ํ‘œ์ค€ํ™”ํ•œ ๊ฒƒ์ด๋‹ค.
@mjohnsullivan
mjohnsullivan / http_server.rs
Last active August 23, 2024 03:19
Simple HTTP server example for Rust
// Updated example from http://rosettacode.org/wiki/Hello_world/Web_server#Rust
// to work with Rust 1.0 beta
use std::net::{TcpStream, TcpListener};
use std::io::{Read, Write};
use std::thread;
fn handle_read(mut stream: &TcpStream) {
let mut buf = [0u8 ;4096];
@MihaelIsaev
MihaelIsaev / CameraViewController.swift
Created April 16, 2015 19:30
This is the example of camera view for iOS written in Swift
import UIKit
import AVFoundation
class ViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate {
@IBOutlet weak var myView: UIView!
var session: AVCaptureSession?
var device: AVCaptureDevice?
var input: AVCaptureDeviceInput?
@vitorbritto
vitorbritto / rm_mysql.md
Last active April 6, 2025 09:16
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

    brew remove mysql
    
@austinhyde
austinhyde / js-observables-binding.md
Last active January 7, 2025 08:27
Vanilla JavaScript Data Binding

Observables

You don't really need a framework or fancy cutting-edge JavaScript features to do two-way data binding. Let's start basic - first and foremost, you need a way to tell when data changes. Traditionally, this is done via an Observer pattern, but a full-blown implementation of that is a little clunky for nice, lightweight JavaScript. So, if native getters/setters are out, the only mechanism we have are accessors:

var n = 5;
function getN() { return n; }
function setN(newN) { n = newN; }

console.log(getN()); // 5

setN(10);