Skip to content

Instantly share code, notes, and snippets.

View andris9's full-sized avatar
🇪🇪

Andris Reinman andris9

🇪🇪
View GitHub Profile
@peteroupc
peteroupc / utf7.js
Last active August 29, 2015 14:02
UTF-7 decoder in JavaScript
/*
Written by Peter O. in 2014.
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
If you like this, you should donate to Peter O.
at: http://upokecenter.com/d/
*/
var CodeUnitAppender = function() {
this.surrogate = -1;
this.lastByte = -1;
repo for a more modern version of qt (4.7)
http://atrpms.net/documentation/install/
http://packages.atrpms.net/dist/el5/qt4/
cat /etc/yum.repos.d/atrpms.repo
[atrpms]
name=ATrpms manual
baseurl=http://dl.atrpms.net/el5-$basearch/atrpms/testing/
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
@creationix
creationix / output.log
Created May 8, 2013 22:02
Working version of generator async code sample. Using node from https://github.com/andywingo/node/tree/v8-3.19
tim@touchsmart:~/Code$ nvm use v0.11.2-generators
Now using node v0.11.2-generators
tim@touchsmart:~/Code$ node --harmony testgen.js
<Buffer 76 61 72 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 29 3b 0a 66 75 6e 63 74 69 6f 6e 20 72 65 61 64 46 69 6c 65 28 70 61 74 68 2c 20 65 6e 63 ...>
Sleeping for 2000ms...
Done
@antirais
antirais / screenshot.py
Created March 2, 2018 11:05
Selenium and Geckodriver browser screenshot
import threading
import traceback
import subprocess
import os
import datetime
from pyvirtualdisplay.smartdisplay import SmartDisplay
from selenium import webdriver
from PIL import Image, ImageDraw, ImageFont
@damoxc
damoxc / _queue.pyx
Created October 26, 2011 12:23
Module for reading Postfix queue files
from libc.stdio cimport FILE, fopen, fclose, fread, feof, ferror, fseek, SEEK_CUR, SEEK_SET, ftell, sscanf
from libc.string cimport memset, strlen, strtok
from cpython.mem cimport PyMem_Malloc, PyMem_Free
cdef extern from "ctype.h":
cdef int isascii (int c)
cdef int iscntrl (int c)
cdef extern from "sys/param.h":
cdef int NBBY
@rhussmann
rhussmann / SignInWithTwitter.js
Created September 6, 2010 06:05
Simple 'sign in with Twitter' implementation in node.js
var http = require('http'),
sys = require('sys'),
URL = require('url'),
querystring = require('querystring'),
OAuth = require('oauth').OAuth;
var oa = new OAuth('https://api.twitter.com/oauth/request_token',
'https://api.twitter.com/oauth/access_token',
'YOUR APP CONSUMER KEY HERE',
'YOUR APP CONSUMER SECRET HERE',
@stared
stared / aspie_traits.md
Last active January 29, 2022 08:16
Interpersonal Traits of Aspies Placed in Context

Interpersonal Traits of Aspies Placed in Context

a chapter from A Mind-Body Look at the Concept of Asperger's Syndrome (pdf) by Michael Samsel, LMHC

A Hacker News discussion (2021) on this list

Uncommunicative Eye Contact

In humans, eye contact is the center of the attachment system. In Asperger's Syndrome there is either an avoidance of eye contact (most common) or an unvarying, relative unblinking, staring, constant eye contact (less common). Avoidant eye contact gives an impression of 'having something to hide', and also eliminates a big channel of communication and trust. Staring eye contact, because of its unchanging nature, is also uncommunicative, and is generally experienced as disturbing on the receiving end.

@mbadolato
mbadolato / WilsonConfidenceIntervalCalculator.php
Last active May 4, 2023 04:14
PHP translation of the Wilson ConfidenceInterval Calculator. Ported from Ruby and uses a hardcoded (pre-calculated) confidence (z value) instead of a dynamic calculation with a translation of Ruby's Statistics2.pnormaldist method. Since z doesn't change once it's computed, nor is the computation dependant on the passed-in values, calculating it …
<?php
/*
* (c) Mark Badolato <mbadolato@gmail.com>
*
* This content is released under the {@link http://www.opensource.org/licenses/MIT MIT License.}
*/
namespace Bado;
@tanguylebarzic
tanguylebarzic / Description.js
Created March 25, 2012 17:31
DKIM signing with Node.js
/*
Heavily inspired by the PHP implementation made by Ahmad Amarullah (available at http://code.google.com/p/php-mail-domain-signer/), with the help of http://phpjs.org/.
Setup:
In dkim-raw-email.js, change the location of your private key and the associatedDomain accordingly to your needs.
Example of use (using aws-lib, https://github.com/mirkok/aws-lib):
@guifromrio
guifromrio / nodejs-ubuntu-bind-port-80.md
Last active January 10, 2024 22:47
Allow Node.js to bind to privileged ports without root access on Ubuntu

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command: