Skip to content

Instantly share code, notes, and snippets.

View pcnate's full-sized avatar

Nathan Baker pcnate

View GitHub Profile
<!DOCTYPE html>
<html>
<head><title>SOUND</title></head>
<body>
<div>Frequence: <span id="frequency"></span></div>
<script type="text/javascript">
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
var oscillatorNode = audioCtx.createOscillator();
var gainNode = audioCtx.createGain();
@velizarn
velizarn / sendgrid.bash
Last active March 12, 2024 13:13
Send email from bash script by using SendGrid API
#!/bin/bash
SENDGRID_API_KEY=""
EMAIL_TO=""
FROM_EMAIL=""
FROM_NAME=""
SUBJECT=""
bodyHTML="<p>Email body goes here</p>"
@bitnetwork
bitnetwork / server.js
Last active July 8, 2023 21:09
A telnet server written in Node.js
var lib_net = require("net");
var lib_chalk = require("chalk");
var clients = {};
var lastId = -1;
function cleanInput(data) {
return data.toString().replace(/(\r\n|\n|\r)/gm,"");
}
@cutaway
cutaway / bigip_decode_cookie.py
Created July 2, 2015 18:33
Deocde BigIP cookies to internal IP address and port number
@NightOwlPrgmr
NightOwlPrgmr / User Defined Key Bindings.json
Last active June 4, 2016 06:21
Sublime Text User Keymap
[
{ "keys": ["alt+shift+up"], "command": "select_lines", "args": {"forward": false} },
{ "keys": ["alt+shift+down"], "command": "select_lines", "args": {"forward": true} },
{ "keys": ["alt+shift+o"], "command": "run_macro_file", "args": {"file": "Packages/User/output.sublime-macro"} },
{ "keys": ["alt+shift+c"], "command": "run_macro_file", "args": {"file": "Packages/User/console.sublime-macro"} },
{ "keys": ["ctrl+shift+t"], "command": "open_recent_file", "args": {"index": 0 } }
]
@magnetikonline
magnetikonline / README.md
Last active March 14, 2024 13:29
NSSM - the Non-Sucking Service Manager cheatsheet.
@zamicol
zamicol / post-receive
Last active July 22, 2022 21:47
Git push to prod
#!/bin/sh
# Use git to push to deploy (aka git push to prod)
# Use 'git push remote master' to push to deploy
# This script only deploys on pushes to master.
#
# HOWTO:
# On your server to deploy, create a bare git directory
# (somewhere like /var/git/<gitProject>)
# Your depoly directory (like /var/www) should be somewhere other than your git repo.
function check(resolved) {
console.log(resolved);
var tag = resolved.split('/').pop(-1);
var latest = tag.slice(1);
var current = atom.getVersion();
if (latest != current) {
atom.notifications.addInfo('new version available: ' + resolved);
// TODO detect platform
// var filename = 'atom-amd64.deb'; // or 'atom.x86_64.rpm'
// var url = 'https://github.com/atom/atom/releases/download/' + tag + '/' + filename;
@mlynch
mlynch / autofocus.js
Last active August 24, 2022 15:03
AngularJS Autofocus directive
/**
* the HTML5 autofocus property can be finicky when it comes to dynamically loaded
* templates and such with AngularJS. Use this simple directive to
* tame this beast once and for all.
*
* Usage:
* <input type="text" autofocus>
*
* License: MIT
*/
@joshbeckman
joshbeckman / gist:7867934
Created December 9, 2013 06:00
Handle drag-n-drop JSON file upload and parsing with javascript.
if (window.File && window.FileReader && window.FileList && window.Blob) {
// Great success!
function handleJSONDrop(evt) {
evt.stopPropagation();
evt.preventDefault();
var files = evt.dataTransfer.files;
// Loop through the FileList and read
for (var i = 0, f; f = files[i]; i++) {
// Only process json files.