Skip to content

Instantly share code, notes, and snippets.

View leMedi's full-sized avatar
🏠
Working from home

Mehdi ElHaij leMedi

🏠
Working from home
View GitHub Profile
@leMedi
leMedi / Playground.hs
Created May 7, 2021 00:45
Plutus Playground Smart Contract
import Control.Applicative (Applicative (pure))
import Control.Monad (void)
import Language.Plutus.Contract
import qualified Language.Plutus.Contract.Constraints as Constraints
import qualified Language.Plutus.Contract.Typed.Tx as Typed
import qualified Language.PlutusTx as PlutusTx
import Language.PlutusTx.Prelude hiding (Applicative (..), Semigroup (..))
import Ledger (PubKeyHash, TxInfo (..), Validator, ValidatorCtx (..),
pubKeyHash, txId, valueSpent)
import qualified Ledger as Ledger
@leMedi
leMedi / Playground.hs
Created May 5, 2021 23:49
Plutus Playground Smart Contract
import Control.Lens (makeClassyPrisms, prism', review)
import Control.Monad (void)
import Control.Monad.Error.Lens (catching, throwing, throwing_)
import Data.Text (Text)
import qualified Data.Text as T
import Language.Plutus.Contract (AsContractError (_ContractError), ContractError, HasAwaitSlot, logInfo,
mapError, select)
import Playground.Contract
import Prelude (Maybe (..), const, show, ($), (.), (<>), (>>), (>>=))
@leMedi
leMedi / ARMDebianUbuntu.md
Created February 19, 2018 15:24 — forked from Liryna/ARMDebianUbuntu.md
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

@leMedi
leMedi / ffmpegToWeb.js
Created November 6, 2017 16:30 — forked from moeiscool/ffmpegToWeb.js
FFMPEG to Web Browser with Express, Socket.IO and JSMPEG
// Shinobi (http://shinobi.video) - FFMPEG H.264 over HTTP Test
// How to Use raw H.264 (Simulated RTSP)
// 1. Start with `node ffmpegToWeb.js`
// 2. Get the IP address of the computer where you did step 1. Example : 127.0.0.1
// 3. Open VLC and "Open Network Stream".
// 4. Input the following without quotes : `http://127.0.0.1:8001/h264` and start.
var child = require('child_process');
var events = require('events');
var express = require('express')
/**
* @param string $dsn DSN string to pass the PDO object. Passed in to prevent tight coupling
* @param string $user Username for a privileged user in the database.
* @param string $password Password matching $user.
*
* @return \PDO
*/
function pdoConnect($dsn, $user, $password) {
$pdo = new PDO($dsn, $user, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);