Skip to content

Instantly share code, notes, and snippets.

Avatar
🍪
Do you agree to share your cookies?

Ray Farias sgnl

🍪
Do you agree to share your cookies?
  • Honolulu, Hawaii
View GitHub Profile
@sgnl
sgnl / .startup_check_swapfile
Created Apr 29, 2021
Ubuntu Check for Swapfile or Create it (4096 default)
View .startup_check_swapfile
#!/bin/sh
swapon_results=$(swapon -s)
if [[ $swapon_results != 0]]; then
dd if=/dev/zero of=/swapfile count=4096 bs=1M
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap sw 0 0" >> /etc/fstab
else
@sgnl
sgnl / README.md
Last active Apr 28, 2020
Telegraf MySQL Plugin Installation Guide
View README.md

Overview

The [MySQL Input Plugin][8] for Telegraf gathers data from a MySQL server.

Setup

Create user for the Telegraf agent to connect with

For connections that are local to the MySQL server, use localhost as your hostname:

@sgnl
sgnl / README.md
Last active Apr 9, 2020
Jenkins Dashboard Process Notes (WIP)
View README.md
@sgnl
sgnl / notes.md
Created Sep 19, 2018
Better POSTMAN app installation on Ubuntu
View notes.md
  1. Download the fucking *.tar.gz file from their site
  2. do this shit...
sudo tar -xzf postman.tar.gz -C /opt
rm postman.tar.gz
sudo ln -s /opt/Postman/Postman /usr/bin/postman

launch postman via your favorite fucking launcher

View gist:ed924594933dfbe77a45dd2ed4da69a5
terraform init
- initializes
- installs modules
- aws
- gce
terraform plan
- test
- audit mode
@sgnl
sgnl / wootric.md
Last active Mar 28, 2018
Wootric webhooks data shapes
View wootric.md

Decline event shape

{
  "timestamp": "2018-03-28 15:06:23 -0700",
  "event_name": "created",
  "decline": {
    "updated_at": "2018-03-28 15:06:20 -0700",
    "survey_id": "XXXXXXXXX",
    "origin_url": "http://localhost:3000/",
View fuck-yea-ditch-life.js
window.onload = _ => {
pumpTheJam(randomItemList, 500)
}
const pumpTheJam = (randomItemList, initalValue) => {
setTimeout(function() {
const elementToRemove = placeRandomTextOnScreen(randomItemList)
setTimeout(_ => {
elementToRemove.remove()
pumpTheJam(randomItemList, 500)
View gist:15eb940aea42382b1f730c9136f6f828
osascript -e 'display notification "Lorem ipsum dolor sit amet" with title "Title" subtitle "subtitle"'
View gist:0180cea3e7eacebd336cc39d285d0435

###Good Morning Agents

Your challenge this morning is to create a function that implements an algorithm using the concepts we've covered this week.

###Challenge

  1. Write an algorithm that takes in 2 strings as parameters (source, find).
  2. Your function should return true if the string passed in as the find parameter is found in the source parameter if source were circular in nature. Meaning there is no end to the source string.
  3. Important: A match would be true if the word to find is partially at the end of the word and at the beginning in sequence.

Ex.

@sgnl
sgnl / scraper.js
Last active Apr 7, 2017
Scrape website's flash card data and output HTML for markdown use
View scraper.js
const got = require('got')
const cheerio = require('cheerio')
const Promise = require('bluebird')
const fs = Promise.promisifyAll(require('fs'))
const baseUrl = 'https://[nope].com/comptia-a-exam/flashcards/902-windows-operating-systems/pages'
function getFrontCard(baseUrl, startPageNumber = 1) {
return got(`${baseUrl}/${startPageNumber}`)
.then(res => {