Skip to content

Instantly share code, notes, and snippets.

View skynet's full-sized avatar

Ionel Roiban skynet

View GitHub Profile
@skynet
skynet / encode.sh
Created July 24, 2019 19:21 — forked from mikoim/README.md
YouTube recommended encoding settings on ffmpeg (+ libx264)
#/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
@skynet
skynet / upgrade-php7.sh
Created December 29, 2018 03:52 — forked from heathdutton/upgrade-php7.sh
Upgrade PHP to 7.3 on Amazon Linux (specifically for Elastic Beanstalk but should work elsewhere)
#!/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:
@skynet
skynet / tangent.js
Created December 19, 2018 18:19
Calculate the Tangent Line of a Circle
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
@skynet
skynet / intersection.js
Created December 19, 2018 18:17
Find the intersection points of two circles
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)
@skynet
skynet / circle.js
Created December 19, 2018 18:12
Create a circle out of three points
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;
@skynet
skynet / map.js
Created December 19, 2018 18:11
Mapping a rectangular grid to a circular space
function map(x, y) {
return [
x * Math.sqrt(1 - y * y / 2),
y * Math.sqrt(1 - x * x / 2)];
}
@skynet
skynet / aws-linux-2-wordpress.sh
Created December 9, 2018 01:02 — forked from byronfriesen/aws-linux-2-wordpress.sh
Amazon Linux 2 LTS - Wordpress / PHP-FPM / NGINX / MariaDB / WP-CLI Auto Install
#!/bin/bash
##############################################################
# Set Your System and Wordpress Config Preferences
##############################################################
export SYSTEM_USER=username # User PHP-FPM runs under
# Database
export WP_DB_NAME=wordpress
<?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:
@skynet
skynet / etc-hosts-on-win.md
Created August 15, 2018 15:50 — forked from zenorocha/etc-hosts-on-win.md
/etc/hosts on Windows

1. Get your IP Address

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/.*\://'`

2. Modify your hosts file

notepad

@skynet
skynet / ballot.sol
Last active January 19, 2018 03:03
pragma solidity ^0.4.0;
contract Ballot {
struct Voter {
uint weight;
bool voted;
uint8 vote;
address delegate;
}
struct Proposal {