Skip to content

Instantly share code, notes, and snippets.

😎
chillin'

Andy Hayden hayd

😎
chillin'
Block or report user

Report or block hayd

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
@hayd
hayd / Dockerfile
Last active Jan 6, 2019
deno-docker
View Dockerfile
FROM hayd/deno:alpine-0.2.5
EXPOSE 1993
WORKDIR /app
ADD . /app
ENTRYPOINT ["deno", "--allow-net", "main.ts"]
View alpine.Dockerfile
FROM frolvlad/alpine-glibc:alpine-3.8
ENV DENO_VERSION=0.2.5
RUN apk add --no-cache curl && \
curl -fsSL https://github.com/denoland/deno/releases/download/v${DENO_VERSION}/deno_linux_x64.gz --output deno.gz && \
gunzip deno.gz && \
chmod 777 deno && \
mv deno /bin/deno && \
apk del curl
View capture_tty.py
import os
import pty
import select
import subprocess
# Example:
# tty_capture(["python", "test.py"], b"abc\n")
# (b'stdin: True, stdout: True, stderr: True\r\n',
# b'read from stdin: abc\r\n')
@hayd
hayd / http-redirect-target.php
Created May 8, 2018
Get HTTP redirect destination for a URL in PHP
View http-redirect-target.php
<?php
// FOLLOW A SINGLE REDIRECT:
// This makes a single request and reads the "Location" header to determine the
// destination. It doesn't check if that location is valid or not.
function get_redirect_target($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
@hayd
hayd / README.md
Created Mar 25, 2017 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications
View README.md


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.

For more about AWS and AWS Certifications and updates to this Gist you should follow me @leonardofed


View invalid.py
def foo():
print("one tab")
print("eight spaces")
@hayd
hayd / sns-to-slack.py
Created May 5, 2016
sns to slack aws lambda python
View sns-to-slack.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Follow these steps to configure the webhook in Slack:
1. Navigate to https://<your-team-domain>.slack.com/services/new
2. Search for and select "Incoming WebHooks".
@hayd
hayd / build.jl
Last active Aug 29, 2015
lexicon test build script
View build.jl
using LightGraphs
macro file(args...) buildfile(args...) end
buildfile(t, s::AbstractString) = buildfile(t, Expr(:string, s))
buildfile(target, source::Expr) = quote
open(joinpath(dirname(@__FILE__), $(esc(target))), "w") do file
println(" - '$($(esc(target)))'")
println(file, "<!-- AUTOGENERATED. See 'docs/build.jl' for source. -->")
@hayd
hayd / Makefile
Created Jun 2, 2015
leanpub makefile
View Makefile
all: book sample
book:
pandoc $(shell cat Book.txt) --smart --table-of-contents --chapters -o Book.pdf
sample:
pandoc $(shell cat Sample.txt) --smart --table-of-contents --chapters -o Sample.pdf
watch:
watchmedo shell-command --patterns="*.md" --command=make
View appending_to_csv.py
def append_frame(f='foo.csv', df=df, keep_open=False, n=1000):
if keep_open:
with open(f, mode='a') as f_:
for i in xrange(n):
df.to_csv(f_, mode='a')
else:
for i in xrange(n):
df.to_csv(f, mode='a')
os.remove(f)
You can’t perform that action at this time.