Skip to content

Instantly share code, notes, and snippets.

@v12
v12 / free_email_provider_domains.txt
Created May 16, 2023 14:17 — forked from tbrianjones/free_email_provider_domains.txt
A list of free email provider domains. Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
126.com
150ml.com
15meg4free.com

Keybase proof

I hereby claim:

  • I am v12 on github.
  • I am v12 (https://keybase.io/v12) on keybase.
  • I have a public key ASBBKtP4B7_ookV-cZULR1_GPlFV075JnZbjKZAV_GJ5mQo

To claim this, I am signing this object:

@v12
v12 / gist:8aec7ff9a29463ee3cd6
Last active August 29, 2015 14:15 — forked from jonathanmoore/gist:2640302
Share Counts

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@v12
v12 / aprintf
Last active August 29, 2015 14:10 — forked from EleotleCram/aprintf
int aprintf(char *str, ...) {
int i, j, count = 0;
va_list argv;
va_start(argv, str);
for(i = 0, j = 0; str[i] != '\0'; i++) {
if (str[i] == '%') {
count++;
Serial.write(reinterpret_cast<const uint8_t*>(str+j), i-j);

Dependency injection in JavaScript

I like the quote that the programming is all about managing complexity. Maybe you've heard that the computer world is a giant construction of abstractions. We simply wrap things and produce new tools over and over again. Just think for a minute. The languages which you use have build-in functionalities and they are probably abstracted functions of other low level operations. It's the same with JavaScript. [STOP]Sooner or later you need to use abstractions made by other developers. I.e. you depend on someone's other code. I like the dependency-free modules, but that's kinda difficult to achieve. Even if you create those nice black-box liked components you still have a part which combines everything. That's where the dependency injection placed in. The ability to manage the dependencies effectively is absolutely necessary nowadays. This articles sums up my observations on the problem.

The goal

Let's say that we have

@v12
v12 / plexconnect
Created September 25, 2014 14:44
PlexConnect Ubuntu init script
#!/bin/bash
### BEGIN INIT INFO
# Provides: plexconnect
# Required-Start: plexmediaserver networking
# Required-Stop: plexmediaserver networking
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: This is the Plex Connect daemon
# Description: This script starts the Plex Connect
# Python scripts in a detached screen.
#!/bin/sh
#
# http://www.packetmischief.ca/monitoring-bind9/
db="/tmp/named.stats"
if [ -z "$1" ]; then
exit
fi
@v12
v12 / yandex-ddns
Last active April 23, 2021 15:24
RouterOS (MikroTik) Yandex DNS subdomain A record updater.
########
# Name: yandex-ddns
# Author: v12
# URL: https://gist.github.com/v12/8892066
########
### Settings section
# There is no way of getting token automatically via script, so you should get it manually: https://pddimp.yandex.ru/get_token.xml?domain_name=example.com
@v12
v12 / wrapText.js
Created January 23, 2014 02:15
Some useful snippets for Canvas
Context2d.prototype.fillTextWrap = function (text, x, y, maxWidth, lineHeight) {
var words = text.split(' '),
line = '',
yOffset = 0,
context = this;
words.forEach(function (word, index) {
line += word + ' ';
if(context.measureText(line).width > maxWidth || index == words.length-1) {
context.fillText(line, x, y + yOffset);
# Generate Private Key
$ openssl genrsa -out server.key 2048
# Generate CSR
$ openssl req -new -out server.csr -key server.key -config openssl.cnf
# => Fill in info
# Check CSR
$ openssl req -text -noout -in server.csr
# Sign Cert
$ openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt -extensions v3_req -extfile openssl.cnf