Skip to content

Instantly share code, notes, and snippets.

🔥
DROP TABLE github_commits;

Ben Atherton Ben-Atherton

🔥
DROP TABLE github_commits;
Block or report user

Report or block Ben-Atherton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Ben-Atherton
Ben-Atherton / productkey.vbs
Created Feb 8, 2017
How to find your Windows product key
View productkey.vbs
Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
x = 14
@Ben-Atherton
Ben-Atherton / apache.conf
Created Feb 8, 2017
How to force HTTPS behind an Amazon Web Services Elastic Load Balancer
View apache.conf
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI}
</VirtualHost>
@Ben-Atherton
Ben-Atherton / iis.config
Created Feb 8, 2017
How to force HTTPS behind an Amazon Web Services Elastic Load Balancer
View iis.config
<rewrite xdt:Transform="Insert">
<rules>
<rule name="HTTPS rewrite behind ELB rule" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="^http$" ignoreCase="false" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{SERVER_NAME}{URL}" />
</rule>
</rules>
@Ben-Atherton
Ben-Atherton / nginx.conf
Created Feb 8, 2017
How to force HTTPS behind an Amazon Web Services Elastic Load Balancer
View nginx.conf
server {
listen 80;
location / {
if ($http_x_forwarded_proto != 'https') {
rewrite ^ https://$host$request_uri? permanent;
}
}
@Ben-Atherton
Ben-Atherton / twitter.php
Created Feb 7, 2017
How to retrieve a Twitter user timeline using the Twitter API version 1.1 in PHP
View twitter.php
<?php
$token = 'YOUR TOKEN';
$token_secret = 'TOKEN SECRET';
$consumer_key = 'YOUR KEY';
$consumer_secret = 'KEY SECRET';
$host = 'api.twitter.com';
$method = 'GET';
$path = '/1.1/statuses/user_timeline.json'; // api call path
View keybase.md

Keybase proof

I hereby claim:

  • I am Ben-Atherton on github.
  • I am benatherton (https://keybase.io/benatherton) on keybase.
  • I have a public key whose fingerprint is 7DF4 68C9 88C1 087A D534 7838 B009 47DD ED00 9E15

To claim this, I am signing this object:

You can’t perform that action at this time.