Skip to content

Instantly share code, notes, and snippets.

View 3p3r's full-sized avatar
🥦
farming...

Sepehr Laal 3p3r

🥦
farming...
View GitHub Profile
@3p3r
3p3r / puppeteer-wsl2-2022.sh
Created February 17, 2022 18:51
puppeteer on WSl2 in 2022
#! bash -eu
# *** BEFORE EXECUTION OF THIS SCRIPT: ***
# follow these links CAREFULLY, step by step, and in order:
# to install X11: https://medium.com/@japheth.yates/the-complete-wsl2-gui-setup-2582828f4577
# to install Chromium: https://askubuntu.com/a/1206153
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
sudo apt install -y build-essential git cmake net-tools xrdp
sudo apt install -y libnss3 libatk-adaptor libcups2 libxkbcommon0 libgtk-3-0 libgbm1
@3p3r
3p3r / esm-package.md
Created December 2, 2021 20:31 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@3p3r
3p3r / udp_send.cpp
Created June 10, 2018 21:27
quick and dirty C++ function to send a udp packet to an address
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <strings.h>
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>
@3p3r
3p3r / README.md
Created August 2, 2017 17:45 — forked from DamonOehlman/README.md
General WebRTC tips and tricks collated over time
@3p3r
3p3r / FindPackage.cmake
Created July 19, 2017 18:41
A general purpose C++ header-only library finder
# Copyright (c) 2017 sepehr laal (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
@3p3r
3p3r / GLSL-Noise.md
Created February 25, 2017 21:50 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@3p3r
3p3r / install-gcc48-linuxbrew-centos6.md
Created January 27, 2017 19:35 — forked from stephenturner/install-gcc48-linuxbrew-centos6.md
Installing gcc 4.8 and Linuxbrew on CentOS 6

Installing gcc 4.8 and Linuxbrew on CentOS 6

The GCC distributed with CentOS 6 is 4.4.7, which is pretty outdated. I'd like to use gcc 4.8+. Also, when trying to install Linuxbrew you run into a dependency loop where Homebrew's gcc depends on zlib, which depends on gcc. Here's how I solved the problem.

Note: Requires sudo privileges.

Resources:

@3p3r
3p3r / ZXingScanner.cs
Last active July 4, 2016 21:03
Zebra Crossing Unity3D WebCam QR Decoder (multi-threaded)
using ZXing;
using ZXing.Common;
using UnityEngine;
using System;
using System.Threading;
using System.Collections.Generic;
/// <summary>
@3p3r
3p3r / ZXingScanner.cs
Last active February 13, 2024 01:44
Zebra Crossing Unity3D WebCam QR Decoder
using ZXing;
using ZXing.Common;
using UnityEngine;
using System.Collections.Generic;
/// <summary>
/// Extremely basic usage of BarcodeDecoder in ZXing
/// library to actively decode QR codes from WebCam.
/// You may download ZXing C# binaries from:
@3p3r
3p3r / readme.md
Created May 31, 2016 04:22 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"

npm adduser