Skip to content

Instantly share code, notes, and snippets.

@sacgov
sacgov / convert-file-to-array.sh
Last active February 6, 2022 13:26
converts a file into json array with each line as the string
#!/bin/sh
# -i is in place and -e is the regular expression
# add a " to start of each line
sed -i -e 's/^/"/' input
# add a ", to end of each line
sed -i -e 's/$/",/' input
["Afghanistan", "Albania", "Algeria", "Angola", "Anguilla", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia, Plurinational State of", "Bonaire, Sint Eustatius and Saba", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cabo Verde", "Cambodia", "Cameroon", "Canada", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Colombia", "Comoros", "Congo", "Congo, The Democratic Republic of The", "Costa Rica", "Cote D'ivoire", "Croatia", "Curacao", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Estonia", "Ethiopia", "Faroe Islands", "Fiji", "Finland", "France", "French Polynesia", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Grenada", "Guadeloupe", "Guam",
@sacgov
sacgov / async-babel.js
Created July 25, 2019 11:55
Async in Babel
"use strict";
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
@sacgov
sacgov / async example
Created June 13, 2019 11:37
async job example
const executeAfterJob = () => {
// pop a notification
console.log("finally my job is done now")
}
const functionThatTakesTime = ( executeAfterJob) => {
setTimeout(executeAfterJob, 5000)
}
const executeJobSync = () => {
var stop = new Date().getTime();
@sacgov
sacgov / package.json
Created June 11, 2019 17:10
package.json
{
"name": "freecodecamp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start":"node app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "sachin govind",
@sacgov
sacgov / sachinBF.b
Created April 28, 2019 08:46
A Brainf*ck program printing my name "Sachin Govind"
-[--->+<]>--.++++++++++++++.++.+++++.+.+++++.-[->+++++<]>-.+++[->++<]>+.[--->+<]>++.+++++++.[------>+<]>.+++++.----------.
@sacgov
sacgov / install.sh
Created August 31, 2018 14:54
Nagios Configuration
#Install Build Dependencies
sudo yum install gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel xinetd unzip
#Create Nagios User and Group
sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
#Install Nagios Core
cd ~
@sacgov
sacgov / action.json
Created January 27, 2018 12:46
action.json
{
"actions": [
{
"name": "MAIN",
"intent": {
"name": "actions.intent.MAIN"
},
"fulfillment": {
"conversationName": "sekaiApp"
}