Skip to content

Instantly share code, notes, and snippets.

View Ben-Atherton's full-sized avatar

Ben Atherton Ben-Atherton

View GitHub Profile

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:

@Ben-Atherton
Ben-Atherton / twitter.php
Created February 7, 2017 17:13
How to retrieve a Twitter user timeline using the Twitter API version 1.1 in 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
@Ben-Atherton
Ben-Atherton / nginx.conf
Created February 8, 2017 10:05
How to force HTTPS behind an Amazon Web Services Elastic Load Balancer
server {
listen 80;
location / {
if ($http_x_forwarded_proto != 'https') {
rewrite ^ https://$host$request_uri? permanent;
}
}
@Ben-Atherton
Ben-Atherton / iis.config
Created February 8, 2017 10:09
How to force HTTPS behind an Amazon Web Services Elastic Load Balancer
<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 / apache.conf
Created February 8, 2017 10:10
How to force HTTPS behind an Amazon Web Services Elastic Load Balancer
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI}
</VirtualHost>
@Ben-Atherton
Ben-Atherton / productkey.vbs
Created February 8, 2017 10:11
How to find your Windows product key
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