Skip to content

Instantly share code, notes, and snippets.

Vitor Carvalho lightningspirit

Block or report user

Report or block lightningspirit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rates_with_dollar_sign.csv
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 4.
country_code,country_name,category,price,prefixes,resource,direction,resolutions
AE,United Arab Emirates,,$0.27 ,9715,CALL,outbound,answered
AE,United Arab Emirates,,$0.27 ,971,CALL,outbound,answered
BR,Brazil,,$0.29 ,"551153, 551154, 551157, 55116, 55117, 55118, 55119, 55126, 55127, 55128, 55129, 55136, 55137, 55138, 55139, 55146, 55147, 55148, 55149, 55156, 55157, 55158, 55159, 55166, 55167, 55168, 55169, 55176, 55177, 55178, 55179, 55186, 55187, 55188, 55189, 5519, 55196, 55197, 55198, 55199, 55216, 55217, 55218, 55219, 55226, 55227, 55228, 55229, 55246, 55247, 55248, 55249, 55276, 55277, 55278, 55279, 55286, 55287, 55288, 55289, 55316, 55317, 55318, 55319, 55326, 55327, 55328, 55329, 5533, 55336, 55337, 55338, 55339, 55346, 55347, 55348, 55349, 55356, 55357, 55358, 55359, 55376, 55377, 55378, 55379, 55386, 55387, 55388, 55389, 55416, 55417, 55418, 55419, 55426, 55427, 55428, 55429, 55436, 55437, 55438, 55439, 55446, 55447, 55448, 55449, 55456, 55457, 55458, 55459, 55466, 55467, 55468, 55469, 55476, 55477,
View 2u_master_december_7th.csv
resource category country_code direction prefixes resolutions type price
CALL tollfree US inbound answered,missed,voicemail 0.012
CALL local US inbound answered,missed,voicemail 0.012
CALL US inbound answered,missed,voicemail 0.012
CALL tollfree AE inbound answered,missed,voicemail 0.67
CALL tollfree AR inbound answered,missed,voicemail 0.7
CALL local AR inbound answered,missed,voicemail 0.04
CALL local AT inbound answered,missed,voicemail 0.02
CALL tollfree AT inbound answered,missed,voicemail 0.59
CALL national AT inbound answered,missed,voicemail 0.04
@lightningspirit
lightningspirit / docker-prune-all
Last active Dec 4, 2018
Docker Container & Images Remover
View docker-prune-all
#!/usr/bin/env sh
docker rm $(docker ps -a | awk '{print $1}')
docker rmi $(docker images | awk '{print $3}')
@lightningspirit
lightningspirit / unload.js
Last active Nov 27, 2018
Redshift Unload query generator from SQL statement (warning: trusts input data)
View unload.js
#!/usr/bin/env node
const fs = require('fs')
const usage = () => {
console.log('Usage: unload <aws-arn> <sql-statement-filepath> <name-of-file-in-s3>')
}
if (process.argv.length < 5 || process.argv[2] == '-h') {
usage()
@lightningspirit
lightningspirit / add-cors.cj
Created Aug 2, 2018
This is a small portion of the core.cj file for call-timeline that aimed to add CORS support using two middlewares.
View add-cors.cj
(defn wrap-options
[app]
(fn [request]
(if (= (request :request-method) :options)
(into request {:status 204})
(app request))))
(defn add-header
[r name value]
(assoc-in r [:headers name] value))
@lightningspirit
lightningspirit / README.md
Created Feb 6, 2018
Hal representers lib prototype
View README.md

Hal representers for Elixir

Have JSON/Hal representers for your modules

Library idea

lib/hal/hal.ex:

defmodule APIWeb.Hal.Assignment
View taxidigital_inbound.csv
country_code type price
AR tollfree $0.70
AR local $0.04
AT local $0.02
AT national $0.04
AU tollfree $0.12
AU local $0.04
BA national $0.20
BB local $0.10
BE local $0.02
View keybase.md

Keybase proof

I hereby claim:

  • I am lightningspirit on github.
  • I am lightningspirit (https://keybase.io/lightningspirit) on keybase.
  • I have a public key ASAI2ZZ17AmXsEVDqamcQBB76i_2Rw8Yne8rvKloLkjjRwo

To claim this, I am signing this object:

@lightningspirit
lightningspirit / gist:f1bbe003cf3b7aab26c1
Created May 11, 2014
Template tag to automatically paginate a WP_Query instance
View gist:f1bbe003cf3b7aab26c1
<?php
if ( !function_exists( 'get_pagination' ) ) :
/**
* Return the pagination for the current (or instead, given) WP_Query or WP_Query_Users
* object returned by paginate_links() function.
*
* @since 3.5.5
* @uses paginate_links()
* @uses $wp_query
@lightningspirit
lightningspirit / gist:b244fbbadfee7d44f893
Created May 5, 2014
How to change the admin menu Post labels
View gist:b244fbbadfee7d44f893
<?php
function change_post_menu_label() {
global $menu, $submenu;
$menu[5][0] = __( 'News' );
$submenu['edit.php'][5][0] = __( 'News' );
$submenu['edit.php'][10][0] = __( 'Add News' );
}
add_action( 'admin_menu', 'change_post_menu_label' );
You can’t perform that action at this time.