Skip to content

Instantly share code, notes, and snippets.

View mjhea0's full-sized avatar

Michael Herman mjhea0

View GitHub Profile
@nepsilon
nepsilon / how-to-find-the-pid-of-a-process-using-a-given-port.md
Created December 27, 2016 02:54
How to find the PID of a process using a given port? — First published in fullweb.io issue #80

How to find the PID of a process using a given port?

Sometimes you have a process you lost the PID, and would like to kill it.

You can use top (or better htop) to search for your process name and press k to kill it. But this isn’t optimal when you aren’t sure of its name. A better alternative is to search by the port opened, for example port 80:

sudo lsof -i :80
@nepsilon
nepsilon / email-address-syntax-validation-let-the-browser-do-it.md
Last active August 14, 2022 18:34
Email address syntax validation? Let the browser do it (without regexp) — First published in fullweb.io issue #77

Email address syntax validation? Let the browser do it (without regexp)

Here is a simple and robust way to check for the validity of an email address syntax directly in the browser. No need for crazy regular expressions.

e = document.createElement('input')
e.type = 'email'
// check some email addresses
e.value = 'hi@'
@nepsilon
nepsilon / understanding-http-status-codes.md
Created November 22, 2016 03:55
Understanding HTTP’s status codes — First published in fullweb.io issue #75

Understanding HTTP’s status codes

Following our series on HTTP, here is a quick note on HTTP status code, sent with the HTTP response. They are organized in 5 categories:

1xx Informational, ex:

  • 100 Continue used when doing a multi-part file upload
  • 101 Switching Protocol used when switching from HTTP to WebSocket

2xx Success, ex:

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@hiway
hiway / pybble.py
Last active June 29, 2023 23:46
Python on Pebble. Yes. It works, with a bit of space to write a decent app and some heap memory to spare. AJAX works, as shown in code.
"""
pybble.py
Yup, you can run Python on your Pebble too! Go thank the good folks who
made Transcrypt, a dead-simple way to take your Python code and translate
it to *very* lean Javascript. In our case, instead of browser, we run it
on Pebble using their equally dead-simple Online IDE and Pebble.js library.
Here's a working example, it runs on a real Pebble Classic.
@busypeoples
busypeoples / TestSetupExampleCRAEnzymeChaiMocka.md
Last active May 13, 2019 13:07
Mocha/Chai/Enyzme test setup with create-react-app

Basic setup for using Enzyme/Mocha/Chai with create-react-app

This is a temporary solution. Might change in the near future, this depends on how create-react-app will implement testing.

create-react-app quick-test-example

cd quick-test-example

npm run eject
@nepsilon
nepsilon / 3-hidden-python-tips.md
Last active October 20, 2016 02:11
3 hidden Python tips — First published in fullweb.io issue #60

3 hidden Python tips 🐍

Hidden from beginner tutorials and seldom found in books.

1. You can multiply a string to repeated it:

>>> "HOOLI-"*2
'HOOLI-HOOLI-'
@leonardofed
leonardofed / README.md
Last active April 29, 2024 10:49
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@nepsilon
nepsilon / crontab-send-html-emails.md
Last active February 19, 2017 13:52
Make crontab send you HTML emails — First published in fullweb.io issue #57

Make crontab send you HTML emails

Any output (to stdout and stderr) generated by a crontab task will be sent to you by email. This is great to generate system reports or be alerted when something goes wrong.

By default crontab (and the MTA it relies on) will use a text/plain MIME type. But you can make crontab tells the mail sender to use another MIME type, like text/html.

Open crontab with crontab -e, and add this line:

@nepsilon
nepsilon / search-bash-zsh-history.md
Last active February 19, 2017 13:48
Searching bash or zsh history — First published in fullweb.io issue #55

Searching bash or zsh history

More often than not, you already typed yesterday the commands you’re about to use today. Wouldn’t it be handy to be able to retrieve the long command instead of typing them yet another time?

Hit Ctrl+R, you’ll see:

(reverse-i-search)`':