Skip to content

Instantly share code, notes, and snippets.

Avatar

Iván Nawrath Castillo inawrath

View GitHub Profile
@inawrath
inawrath / Problem homebrew bigsur.md
Last active Nov 19, 2020
Problem homebrew bigsur
View Problem homebrew bigsur.md
  1. Install Tools Xcode
  2. Run in terminal sudo xcode-select --switch /Library/Developer/CommandLineTools
  3. Profit

Alternative if first solution not working

  1. Download Xcode beta 12.3
  2. Install (double click)
  3. Run in terminal xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
  4. Profit
@inawrath
inawrath / open-tab.js
Created Sep 29, 2020
Open Tab in iOS Safari with JavaScript vanilla
View open-tab.js
const loadingPage = `
<style>
/*Huge thanks to @tobiasahlin at http://tobiasahlin.com/spinkit/ */
.spinner {
margin: 100px auto 0;
width: 70px;
text-align: center;
}
.spinner > div {
@inawrath
inawrath / install_php55_ubuntu.sh
Created Mar 28, 2020 — forked from jniltinho/ install_php55_ubuntu.sh
Install PHP 5.5.38 on Ubuntu 16.04 64Bits
View install_php55_ubuntu.sh
#!/bin/bash
### Install PHP 5.5.38 on Ubuntu 16.04 64Bits
### https://www.howtoforge.com/tutorial/how-to-install-php-5-6-on-ubuntu-16-04/
apt-get -y install build-essential libxml2-dev libxslt1-dev
apt-get -y install libfcgi-dev libfcgi0ldbl libjpeg62-dbg libxml2-dev
apt-get -y install libmcrypt-dev libssl-dev libc-client2007e libc-client2007e-dev
apt-get -y install libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng12-dev
apt-get -y install libfreetype6-dev libkrb5-dev libpq-dev libicu-dev
@inawrath
inawrath / settings_sublime.json
Created Nov 28, 2018
Permute Unique lines sublime
View settings_sublime.json
{ "keys": ["f8"], "command": "permute_lines", "args": {"operation": "unique"} }
@inawrath
inawrath / clip.py
Created Nov 7, 2018
Copy to clipboard in IPython
View clip.py
from IPython.core.magic import register_line_magic
@register_line_magic
def clip(line):
global_dict = globals()
if not line in global_dict:
return
value = global_dict[line]
import os
os.system("echo '%s' | pbcopy" % str(value))
del clip
@inawrath
inawrath / index.html
Last active Jul 19, 2018
Example ReactJS
View index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNext Bin Sketch</title>
<!-- put additional styles and scripts here -->
<link href="https://fonts.googleapis.com/css?family=Glass+Antiqua" rel="stylesheet" type="text/css">
<!-- CSS Reset -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.css">
@inawrath
inawrath / example.js
Created Jun 26, 2018
Multiple request axios
View example.js
axios.all([
axios.get('http://google.com'),
axios.get('http://apple.com')
])
.then(axios.spread((googleRes, appleRes) => {
// do something with both responses
});
@inawrath
inawrath / onblur.jsx
Created Apr 16, 2018 — forked from pstoica/OnBlurComponent.jsx
onBlur for entire react component
View onblur.jsx
var HelloMessage = React.createClass({
render: function() {
return <div tabIndex="1" onBlur={this.onBlur}>
Hello <input type="text" value="wat"/>
</div>;
},
onBlur: function(e) {
var currentTarget = e.currentTarget;
View gist:5ac5597d1438a55a91066ce1619fb0d2
Install docker CE ubuntu how sudo
# curl -sSL get.docker.io | sh
@inawrath
inawrath / gist:3341b56a98cd1f349965ff87ac4cd6ab
Created Jun 14, 2017
Enabling URL token validation varnish
View gist:3341b56a98cd1f349965ff87ac4cd6ab
Enabling URL token validation
Last updated December 15, 2016
Token validation allows you to create URLs that expire. Tokens are generated within your web application and appended to URLs in a query string. Requests are authenticated at Fastly's edge instead of your origin server. When Fastly receives a request for the URL, the token is validated before serving the content. After a configurable period of time, the token expires.
Adding custom VCL
To enable token validation, you'll need to create a Varnish configuration named vcl_recv and add the following example code to it.
IMPORTANT: The ability to upload custom VCL code is disabled by default when you sign up. To enable this ability for your account, contact support@fastly.com and request it.
/* make sure there is a token */
if (req.url !~ ".+\?.*token=(\d{10,11})_([^&]+)") {