Skip to content

Instantly share code, notes, and snippets.

View godfreyd's full-sized avatar

Sergei Bocharov godfreyd

View GitHub Profile
@godfreyd
godfreyd / gist:4a8612cc928bf5bb974fd1511d832876
Created November 10, 2020 19:08 — forked from WhoAteDaCake/gist:37823722bdf27fc03527f5b54c0ca6f0
Script to import Geonames into PostgreSQL
#!/bin/bash
#===============================================================================
#
# FILE: getgeo.sh
#
# USAGE: ./getgeo.sh
#
# DESCRIPTION: run the script so that the geodata will be downloaded and inserted into your
# database
#
#!/bin/bash
#===============================================================================
#
# FILE: getgeo.sh
#
# USAGE: ./getgeo.sh
#
# DESCRIPTION: run the script so that the geodata will be downloaded and inserted into your
# database
#
module.exports = {
block: 'page',
title: 'Title of the page',
favicon: '/favicon.ico',
head: [
{ elem: 'meta', attrs: { name: 'description', content: '' }},
{ elem: 'css', url: 'index.min.css' }
],
scripts: [{ elem: 'js', url: 'index.min.js' }],
content: [
var google = require('googleapis'),
OAuth2 = google.auth.OAuth2;
function GoogleYoutube(credentials) {
this.oauth2Client = new OAuth2(credentials.client_id, credentials.client_secret, credentials.redirect_url);
};
GoogleYoutube.prototype.searchList = function(user, params, callback) {
this.oauth2Client.setCredentials({
var Render = require('../render'),
render = Render.render,
config = require('../config'),
moment = require('moment'),
helpers = require('../helpers'),
env = process.env;
function getContent(req, res) {
var passport = req.session.passport || {},
servicesYouTube = config.services.youtube,
var passport = require('passport'),
YoutubeV3Strategy = require('passport-youtube-v3').Strategy,
env = process.env;
if (!env.YOUTUBE_APP_ID || !env.YOUTUBE_APP_SECRET) {
try {
var config = require('./config'),
servicesYouTube = config.services.youtube;
} catch (err) {}
}
var Twitter = require('twitter');
module.exports = function getContent(config, params) {
return new Promise(function(resolve, reject) {
new Twitter(config).get('search/tweets', params, function(err, data) {
if (err) return reject(err);
if(!data.statuses.length) return resolve({});
resolve({
nextPageId: data.statuses[data.statuses.length -1].id,
var Render = require('../render'),
render = Render.render,
config = require('../config'),
moment = require('moment'),
helpers = require('../helpers'),
env = process.env;
/**
* Функция-обертка, контроллер.
* @function
var router = require('express').Router(),
controllers = require('./controllers');
router
.get('/ping/', function(req, res) {
res.send('ok');
})
.get('/', controllers.getContent);
module.exports = router;
var fs = require('fs'),
app = require('./app'),
config = require('./config'),
env = process.env,
port = env.PORT || (env.PORT = config.defaultPort),
isSocket = isNaN(port);
exports.start = function() {
app
.listen(port, () => {