Skip to content

Instantly share code, notes, and snippets.

View dryleaf's full-sized avatar
🎧
Listen, can you hear it?

Josimar Lopes dryleaf

🎧
Listen, can you hear it?
View GitHub Profile
@dryleaf
dryleaf / UbuntuMini.md
Created December 8, 2022 09:27 — forked from AugustoCiuffoletti/UbuntuMini.md
A script to produce a minimal Ubuntu image for VirtualBox (without the mini.iso)

Living without the Ubuntu mini.iso (in VirtualBox)

The mini.iso for the Ubuntu distribution is legacy since version 20.04LTS (Focal Fossa). This is a bad news for those (like me) that formerly used this distribution to produce lightweight virtual machines for development, teaching, testing, etc. A distribution of the mini.iso for Ubuntu 20.04 is indeed still available here, but there is no guarantee that its availability will continue after Focal Fossa. An askubuntu post on the topic (there are several) is here.

So I decided to find a way to do without the mini.iso, and I wrote this script that takes to the ''tasksel'' step starting from a cloud image in the ubuntu repository. You have many options here about the image format to use: I refer to the .ova file that you find in fo

@dryleaf
dryleaf / revert-a-commit.md
Created May 18, 2022 04:14 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@dryleaf
dryleaf / install-docker.sh
Created April 3, 2022 06:59 — forked from shivekkhurana/install-docker.sh
Install Docker and Docker Compose on a Ubuntu Machine (Tested on AWS)
#!/bin/sh
set -eu
# Docker
sudo apt remove --yes docker docker-engine docker.io || true
sudo apt update
sudo apt --yes --no-install-recommends install apt-transport-https ca-certificates
wget --quiet --output-document=- https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
#!/bin/bash
## Conventions:
##
## Working directory has the same name as the s3 bucket.
## Script is executed from the parent of this directory.
##
BUCKET=$1
@dryleaf
dryleaf / next_nginx.md
Created June 18, 2021 11:52 — forked from kocisov/next_nginx.md
How to setup next.js app on nginx with letsencrypt

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw

@dryleaf
dryleaf / next_nginx.md
Created June 13, 2021 11:51 — forked from joelmasters/next_nginx.md
How to setup next.js app on nginx with letsencrypt

How to setup next.js app on nginx with letsencrypt/getssl

next.js, nginx, reverse-proxy, ssl

Next.js package setup

Your server.js file should look like the following. Make sure you're serving static files!

const { createServer } = require('http');
const { parse } = require('url');
const next = require('next');
@dryleaf
dryleaf / README.md
Created April 30, 2021 23:41 — forked from sithuwin93/README.md
NextJS sitemap generator with dynamic URL

NextJS sitemap generator

Install

The current setup has been tested on Next Js 7.0.0.

You need to install Axios.

$ npm install axios
@dryleaf
dryleaf / python_trader_for_medium_article_v1.py
Created April 16, 2021 14:46 — forked from pacarvalho/python_trader_for_medium_article_v1.py
Simple python script for trading currency pair on forex.com
from gcapi import GCapiClient # From https://github.com/rickykim93/gcapi-python
from gcapi.gcapi_tools import format_date # From https://github.com/rickykim93/gcapi-python
from datetime import datetime
from time import sleep
import numpy
def check_sell_criteria(prices):
# TODO: Write your algorithm to detect sell condition here
return False

1. Adding webpack bundle analyzer to NextJs app (Production)

a) Install webpack bundle analyzer as a dev dependancy

npm install --save-dev webpack-bundle-analyzer

or

yarn add -D webpack-bundle-analyzer
@dryleaf
dryleaf / device-detection.css
Last active October 24, 2019 01:36
css device type detection (using ios `@supports`)
/* start ios/android device detection */
.supports-ios {
display: none;
}
.supports-android {
display: block;
}
@supports (-webkit-overflow-scrolling: touch) {
.supports-ios {
display: block;