echo `ifconfig $(netstat -nr | grep -e default -e "^0\.0\.0\.0" | head -1 | awk '{print $NF}') | grep -e "inet " | sed -e 's/.*inet //' -e 's/ .*//' -e 's/.*\://'`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
ffmpeg -i input -c:v libx264 -preset slow -profile:v high -crf 18 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 -c:a aac -b:a 384k -profile:a aac_low output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Upgrade an Amazon Linux EC2 to PHP 7.3 | |
# | |
# Last tested w/ PHP 7.2 AWS Linux version 2.8.5 | |
# | |
# Must be ran as sudo: | |
# sudo bash upgrade-php7.sh | |
# | |
# Can be added to ./.ebextensions/20_php.config like so: | |
# container_commands: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tangentLine(M, r, alpha) { | |
T = { | |
x: M.x + Math.cos(alpha) * r, | |
y: M.y + Math.sin(alpha) * r | |
} | |
v = { | |
x: T.y - M.y, | |
y: M.x - T.x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d = hypot(B.x - A.x, B.y - A.y) | |
if (d <= A.r + B.r && d >= abs(B.r - A.r)) { | |
ex = (B.x - A.x) / d | |
ey = (B.y - A.y) / d | |
x = (A.r * A.r - B.r * B.r + d * d) / (2 * d) | |
y = sqrt(A.r * A.r - x * x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function circleFromThreePoints(p1, p2, p3) { | |
var x1 = p1.x; | |
var y1 = p1.y; | |
var x2 = p2.x; | |
var y2 = p2.y; | |
var x3 = p3.x; | |
var y3 = p3.y; | |
var a = x1 * (y2 - y3) - y1 * (x2 - x3) + x2 * y3 - x3 * y2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function map(x, y) { | |
return [ | |
x * Math.sqrt(1 - y * y / 2), | |
y * Math.sqrt(1 - x * x / 2)]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################## | |
# Set Your System and Wordpress Config Preferences | |
############################################################## | |
export SYSTEM_USER=username # User PHP-FPM runs under | |
# Database | |
export WP_DB_NAME=wordpress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Task: create an application that: | |
- imports the provided XML files (which contain sector data). | |
- generate "alerts" based on the ingest data. | |
- display the generated alerts in a table. | |
Rules/Notes: | |
Alerts: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
contract Ballot { | |
struct Voter { | |
uint weight; | |
bool voted; | |
uint8 vote; | |
address delegate; | |
} | |
struct Proposal { |
NewerOlder