Skip to content

Instantly share code, notes, and snippets.

View uladkasach's full-sized avatar

Uladzimir Kasacheuski uladkasach

  • Miami, FL
View GitHub Profile
// generate list of values from list of objects's values for a key
var colors = events.map(function(a) {return a.color;});
// add onload, instead of replace
window.addEventListener("load", function_reference);
// Async Request
var xhr = new XMLHttpRequest();
xhr.open("POST", destination_path, true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
@uladkasach
uladkasach / default-nginx-config
Created April 6, 2017 16:48
Content of Default Nginx File
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
///////////
// Singleton
///////////
var car = {
desc : null,
color : "red",
getInfo: function() {
return 'A ' + this.color + ' ' + this.desc + '.';
},
@uladkasach
uladkasach / packaging_prov_vagrant.rb
Created June 8, 2017 17:52
Shell Provisioner for Packaging Vagrant
config.ssh.forward_agent = true;
config.vm.provision "shell" do |s|
your_launchpad_name = "Launchpad Name";
your_launchpad_email = "launchpademail@provider.com";
your_launchpad_username = "launchpadusername";
your_gpg_password = "a_gpg_password";
your_git_email = "yourgitemail@provider.com";
your_git_username = "gitusername";
s.inline = <<-SHELL
echo "##########################";
@uladkasach
uladkasach / ssh_tunnel_for_phpmyadmin.sh
Last active July 15, 2017 02:03
Instructions for connecting phpmyadmin to a remote server w/ ssh tunnel
# https://degreesofzero.com/article/manage-remote-mysql-servers-with-local-phpmyadmin.html
# open tunnel
ssh -fNL 3307:localhost:3306 USERNAME@HOST
# test tunnel
ps aux | grep ssh
# on local, open myadmin config
@uladkasach
uladkasach / regex_and_unix.txt
Last active July 17, 2017 14:10
useful regex and unix commands
[^\\\\]console.log
## find string which exists in any file recursivly throughout directory
grep -r -o -i "string" *
## find files w/ names containing string
find . -type f -name "*string*"
## detect if script is being run from terminal or another script
if [[ -t 1 ]]; then
@uladkasach
uladkasach / timeline_chartjs.html
Created July 18, 2017 19:48
Timeline ChartJS working w/ two point datasets
<div style = 'width:500px; height:500px;'>
<canvas id="canvas" width="400" height="400"></canvas>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>
<script>
window.chartColors = {
/*
This code is based on the LwIP SNTP example
*/
// glibc dependencies:
#include <string.h>
#include <time.h>
#include <sys/time.h>
// espress IDF dependencies
#include "freertos/FreeRTOS.h"