Skip to content

Instantly share code, notes, and snippets.

View web_toast.js
import Toastify from 'toastify-js'; //
import "toastify-js/src/toastify.css";
//To use:
//import toast from '../web_toast.js';
//toast(message,class(optional), options)
//My default is that the toast stays open until dismissed and defaults to bootstrap's "bg-info" if no class is specified.
//NOTE: In an SPA, you'll need to clear any persistent toasts on page switch
//use import {closeAll as clearToasts} from './web_toast.js';
View admin_view_logs.svelte
export let params={};
export let service=null;
export let id=null;
import Fa from 'svelte-fa'
import { faEdit, faPlus, faTrash } from '@fortawesome/free-solid-svg-icons';
import feathers from '../web_feathers.js';
const rest = feathers.service('logs');
avimar / index.js
Created Feb 15, 2019
FreeSWITCH de-register monitor
View index.js
#! /usr/bin/node
var nodemailer = require("nodemailer");
var transport = nodemailer.createTransport("sendmail");
function fix_len(num, len){
if(len<=5) return ("00000" + num).slice(-len);
else {
var seed="0000000000";
while(seed.length<len) seed+=seed;
avimar / 1.txt
Last active Feb 26, 2018
testing prevention
View 1.txt
Sample file.
avimar /
Last active Jul 1, 2017
Node.js/Javascript Stack

Programming Environment:

node.js backend:

  • nconf: loadable, pluggable configuration
  • restify: instead of express, it's oriented for APIs
  • bunyan: for logging, built in support from restify
  • knex.js: SQL query builder/promises/pooling (but it's not an ORM)
  • PM2: deploy and clustering
View gist:16824955e21781c7e2c6594ef743bc6f
`show create table logs_fs`
CREATE TABLE `logs_fs` (
`uuid` char(36) DEFAULT NULL,
`host` varchar(4) DEFAULT NULL,
`date` datetime(6) NOT NULL,
`hrtime` bigint(20) unsigned NOT NULL,
`level` tinyint(4) DEFAULT NULL,
`value` text,
KEY `uuid` (`uuid`),

Keybase proof

I hereby claim:

  • I am avimar on github.
  • I am avimarcus ( on keybase.
  • I have a public key whose fingerprint is 1AFA CC40 32FD 2FE9 BCE3 88FE D5DD 1501 34E0 ABD8

To claim this, I am signing this object:

avimar / isracard.js
Last active Jun 18, 2020 — forked from israelidanny/isracard.js
Checks the validity of a given Isracard credit card number
View isracard.js
/*License: MIT*/
function isracardCheck(num) {//algorithm explanation:
if(typeof num !== 'number') num=''+num;
if(num.length < 8 || num.length > 9) return false;
var sum=0;
return sum % 11 == 0;
avimar / pcap2wav
Last active Oct 14, 2021
Convert raw PCAP files into a .wav file
View pcap2wav
# pcap2wav
# Original Author: Michael Collins <>
#Standard disclaimer: batteries not included, your mileage may vary...
# Updated by Avi Marcus <>
# Accepts arg of pcap file w/only 2 RTP streams
# Creates a .<codec> file and a .wav file
# For codecs other than PCMA and PCMU the script calls fs_cli and does a little recording to create the wav file(s)
avimar / getRegion.js
Last active Sep 15, 2016
View getRegion.js
var NorthAmerica=require('./NorthAmerica.json');
var fp = require('lodash/fp');
function getRegionForAreaCode(areaCode){
return fp.findKey(function(o) {
return o.includes(areaCode);