Skip to content

Instantly share code, notes, and snippets.

View amaurycatelan's full-sized avatar
🌻
what's up, doc?

Amaury Catelan amaurycatelan

🌻
what's up, doc?
View GitHub Profile
@amaurycatelan
amaurycatelan / Setup-ubuntu-for-web-development.sh
Created December 18, 2019 03:46 — forked from przbadu/Setup-ubuntu-for-web-development.sh
Setting up ubuntu for web development for first time
#!/bin/sh
# Author: przbadu
# email: [email protected]
# github: github.com/przbadu
# update ubuntu
sudo apt-get update
# install vim, git, curl, tmux
sudo apt-get install vim git curl tmux
# install the silver searcher
@amaurycatelan
amaurycatelan / server_certificates_to_pem.md
Created November 20, 2019 17:04 — forked from stevenhaddox/server_certificates_to_pem.md
Convert .crt & .key files into .pem file for HTTParty

Two ways to do it, but only worked for me so I'll put it first and the second for reference:

$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -out hostname.p12
$ openssl pkcs12 -in hostname.p12 -nodes -out hostname.pem

Other options for this method in comments below:

# Note, the -certfile root.crt appends all CA certs to the export, I've never needed these so it's optional for my personal steps
$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -certfile root.crt -out hostname.p12

Note, I've always had my hostname.crt as part of my .pem, so I keep my certs but apparently you may not have to, hence the nocerts flag being an extra option in this sample

@amaurycatelan
amaurycatelan / instructions.md
Created November 18, 2019 16:38 — forked from andrewn/instructions.md
Testing SSL (LetsEncrypt certificate and loopback domain)

Testing SSL (LetsEncrypt certificate and loopback domain)

General approach

This sets up a publically-available domain that loops back to localhost IP address 127.0.0.1. For example, this address could be localhost.example.com if we controlled the example.com domain. This relies on having a public domain name whose DNS records you can control. We can then generate LetsEncrypt certificates for this domain.

Our HTTP server runs on localhost:80 (default HTTP port). This lets us visit http://localhost.example.com in a web browser and see the server running on localhost:80.

We then run an HTTPS proxy server on localhost:443 (default HTTPS port) that uses the LetsEncrypt certificates we generated for localhost.example.com. Visiting https://localhost.example.com hits the proxy, which returns the correct certificates meaning the browser displays the "Secure" message. The proxy then passes the request through to the HTTP server.

@amaurycatelan
amaurycatelan / .zshrc
Created November 12, 2019 22:07 — forked from ThYpHo0n/.zshrc
WSL(2) bash profile helpers
# Windows XSrv config
export $(dbus-launch)
export LIBGL_ALWAYS_INDIRECT=1
export WSL_VERSION=$(wsl.exe -l -v | grep -a '[*]' | sed 's/[^0-9]*//g')
export WSL_HOST=$(tail -1 /etc/resolv.conf | cut -d' ' -f2)
export DISPLAY=$WSL_HOST:0

How To Get Started In Google Apps Script

Initially intended to extend G Suite apps, I like to think of Google Apps Script as a gateway to more kinds of development. Think of it as workflow glue and the power of programming that can interract with Google Apps and external APIs too!

Purpose

Provide a living document for whenever someone asks, " so, how do i get started with Google Apps Script?".

Working Outline

Just the orgainizing principles and some key links.

1 Starting point: Good Things to Keep in Mind

Scripts are 'bound' to a container like sheets, docs, slides or forms. These can be accessed from the containing doc and opened say in sheets by going to the menu Tools > Script editor. Scripts can also be standalone for addons or web apps. Your script home page is a dashboard found here script.google.com. The help link there will get you to an explanation of the dashboard.

@amaurycatelan
amaurycatelan / getTotps.js
Created August 12, 2019 05:19 — forked from nmurthy/getTotps.js
export authy totp codes
/* base32 */
/*
Copyright (c) 2011, Chris Umbel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@amaurycatelan
amaurycatelan / exportSecretFromAuthy.md
Created August 12, 2019 05:08 — forked from dataserver/exportSecretFromAuthy.md
Exporting Secret code from Authy to other password managers
#Basic equasion, I do it this way to increase reliablity because I trust JavaScript's date parsing more than writing a regex against nightbot.
$(eval Math.trunc((Date.now()- Date.parse('$(twitch mellana "{{uptimeAt}}")'))/(1000*60*60));)
#Version 1, repeats the math multiple times
@mellana You've been live for just over $(eval Math.trunc((Date.now()- Date.parse('$(twitch mellana "{{uptimeAt}}")'))/(1000*60*60));) hours. By this point in your broadcast you should have consumed at least $(eval 4*Math.trunc((Date.now()- Date.parse('$(twitch mellana "{{uptimeAt}}")'))/(1000*60*60));)oz ($(eval 120*Math.trunc((Date.now()- Date.parse('$(twitch mellana "{{uptimeAt}}")'))/(1000*60*60));)mL) of water to maintain optimum hydration.
#Version 2, builds string in Javascript, but only does math once!
$(eval const hours = Math.trunc((Date.now()- Date.parse('$(twitch mellana "{{uptimeAt}}")'))/(1000*60*60)); "@mellana You've been live for just over " + hours + " hours. By this point in your broadcast you should have consum
@amaurycatelan
amaurycatelan / urllib-request_basicAuth.py
Created July 10, 2019 20:21 — forked from kaito834/urllib-request_basicAuth.py
Python 3.x snippet code for Basic Authentication HTTP request by urllib.request
#!/usr/bin/env python
#
# I tested by Python 3.4.3 on Windows 8.1
# Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
import urllib.request
import getpass
# If you access to url below via Proxy,
# set environment variable 'http_proxy' before execute this.
@amaurycatelan
amaurycatelan / index.js
Created June 29, 2019 04:09
Simple, complete example of a bot in Discord.js
// Load up the discord.js library
const Discord = require("discord.js");
// This is your client. Some people call it `bot`, some people call it `self`,
// some might call it `cootchie`. Either way, when you see `client.something`, or `bot.something`,
// this is what we're refering to. Your client.
const client = new Discord.Client();
// Here we load the config.json file that contains our token and our prefix values.
const config = require("./config.json");