Skip to content

Instantly share code, notes, and snippets.

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

David Eugene egdavid

🏠
Working from home
  • France
  • 11:57 (UTC -12:00)
View GitHub Profile
@egdavid
egdavid / puppeteer-axios-pdf.js
Last active March 11, 2023 16:18
Getting a PDF from an URL in a secured session in NodeJS using Puppeteer, FileSystem, Axios and HTTPS
/**
* Download a file (PDF in this case) from a secure URL after puppeteer login
**/
// Puppeteer init
const browser = await puppeteer.launch(puppeteerOptions);
const page = await browser.newPage();
page.setViewport({ width: 1366, height: 768 });
// Add login logic
@itsmikita
itsmikita / KILL-LARAVEL-VALET-MAC.md
Last active April 23, 2024 12:09
Uninstall Laravel/Valet from MacOS completely

Do the below and never try this again!

valet uninstall
composer global remove laravel/valet
sudo rm -rfv /usr/local/bin/valet
sudo rm -rfv ~/.valet
brew rm -rfv nginx php@7.2 php@7.3 dnsmasq
sudo rm -rfv /usr/local/Cellar/dnsmasq
sudo rm -rfv /usr/local/Cellar/nginx
@zmts
zmts / docker.md
Last active May 19, 2024 14:47
Docker, TypeScript, Node.js

Docker, TypeScript, Node.js

Preconditions:

  • TS application listening port: 7777
|-- dist
|-- src
|-- .dockerignore
|-- Dockerfile
@styblope
styblope / docker-api-port.md
Last active May 20, 2024 14:20
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"]}
    
@jherax
jherax / filterArray.js
Last active May 6, 2024 09:35
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@keeferrourke
keeferrourke / install-google-fonts.sh
Last active May 22, 2023 12:38
A bash script to install all Google Fonts, system wide, on debian based systems (ex. Ubuntu)
#!/bin/sh
# Written by: Keefer Rourke <https://krourke.org>
# Based on AUR package <https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ttf-google-fonts-git>
# dependancies: fonts-cantarell, ttf-ubuntu-font-family, git
sudo apt-get install fonts-cantarell ttf-ubuntu-font-family git
srcdir="/tmp/google-fonts"
pkgdir="/usr/share/fonts/truetype/google-fonts"
giturl="git://github.com/google/fonts.git"
@lptorres
lptorres / multi2single.py
Created December 4, 2013 01:55
A simple script that converts shapefiles with multipart polygons into singlepart polygons, and copies the fields of the source shapefile. This script is based on a script by Paolo Corti, found here: https://gist.github.com/anonymous/735330 The original script only converts multipolygons by creating a new feature for each part of a multipolygon. …
import os
from osgeo import gdal, ogr, osr
import sys
def initFields(in_lyr, out_lyr):
#Arbitrarily get the first feature
feat = in_lyr[0]
#loop over each field