Skip to content

Instantly share code, notes, and snippets.

View Abreto's full-sized avatar
🔋
Charging

Abreto Abreto

🔋
Charging
View GitHub Profile

Adopted from here https://topaxi.codes/use-npm-without-root-or-sudo-rights/

I'm saving this as a gist and modifying it to ensure that if the original blog post disappears it lives on somewhere.

Added some notes for Ubuntu 18.04 and similar.

Today we're going to setup our npm installation to be used without root or sudo rights.

By default, if you install packages globally with npm, npm tries to install them into a system directory (i.e. /usr/local/lib/node_modules). With the next steps, we're going to use your home directory for those files.

@Abreto
Abreto / certbot-wildcard.sh
Last active February 16, 2020 14:57
for wildcard domains
#!/usr/bin/env sh
# certbot certonly --manual --preferred-challenges=dns-01 --server=https://acme-v02.api.letsencrypt.org/directory
set -x
new () {
docker run --rm -it \
-v "$(pwd)":/etc/letsencrypt \
certbot/certbot \
@Aerijo
Aerijo / example.tex
Last active January 16, 2021 08:43
LaTeX commands for Hoare logic
\documentclass[a4paper]{article}
\input{./hoare.tex}
\begin{document}
\begin{hoare}
\heq[a]{m * (a-b) > 0}{n := a-b}{m * n > 0}{\A}
\heq[b]{1 * (a-b) > 0}{m := 1}{m * (a-b) > 0}{\A}
\heq[c]{a > b}{m := 1}{m * (a-b) > 0}{\PrE(b)}
\heq[d]{a > b}{m := 1; n := a-b}{m * n > 0}{\Seq(c, a)}
\end{hoare}
@juanpabloaj
juanpabloaj / logging_env.py
Last active March 1, 2024 13:09
python logging, log level with environment variable
import os
import logging
LOGLEVEL = os.environ.get('LOGLEVEL', 'INFO').upper()
logging.basicConfig(level=LOGLEVEL)
@gaearon
gaearon / modern_js.md
Last active April 18, 2024 15:01
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@zuyu
zuyu / ubuntu-install-gcc-6
Last active May 3, 2024 06:57
Install gcc 6 on Ubuntu
sudo apt update && \
sudo apt install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt update && \
sudo apt install gcc-6 g++-6 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \
gcc -v
@danielsharvey
danielsharvey / convert_cpbitmap
Last active September 15, 2022 14:32
Converting iPhone iOS '.cpbitmap' images to PNGs
#!/usr/bin/python
from PIL import Image,ImageOps
import struct
import sys
if len(sys.argv) < 3:
print "Need two args: source_filename and result_filename\n";
sys.exit(0)
filename = sys.argv[1]
result_filename = sys.argv[2]
@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active May 7, 2024 00:47
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@ruzickap
ruzickap / aws_create_site.yml
Created February 16, 2017 12:35
Ansible playbook which creates instances and tag volumes
---
- name: Create Instance in AWS
hosts: localhost
connection: local
gather_facts: false
vars:
aws_access_key: "xxxxxx"
aws_secret_key: "xxxxxx"
security_token: "xxxxxx"
@Musinux
Musinux / install-packages.sh
Last active March 29, 2021 12:49
VNC xstartup for unity WARNING ! THIS WAS WRITTEN A LONG TIME AGO (2018), IT MAY NOT BE RELEVANT ANYMORE
#!/bin/bash
# WARNING ! THIS WAS WRITTEN A LONG TIME AGO (2018), IT MAY NOT BE RELEVANT ANYMORE
sudo apt-get install vnc4server ubuntu-desktop
sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal