I hereby claim:
- I am l11r on github.
- I am l11r (https://keybase.io/l11r) on keybase.
- I have a public key ASBd9ZJKPqfys-B12PWDpjBd7kixBYoSUZthDf1DPSQphwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I'm writing this mostly as a reference for myself. This could also be helpful to people who are new to GO.
Until Problem 3 we will assume we are dealing with a JSON for which we know the data types of key,value pairs. Only in Problem 3 we will look at how Type Switch is used to parse a 100% arbitary JSON
I know the following examples given here can be easily solved by declaring approprite structs and just decoding the PUT JSON into them, but, as im not able to come up with a better scenario, im going to stick with this to explain arbitrary JSON parsing.
I hereby claim:
To claim this, I am signing this object:
r.table('users').changes() | |
.filter(r.row('new_val')('profile').ne(r.row('old_val')('profile'))) | |
.then(function (cursor) { | |
cursor.each(async function (err, row) { | |
if (err) new Error(err); | |
сonsole.log('Feed change detected!'); | |
await setLocale({from: {id: row.old_val.id}}) | |
if (row.old_val && row.new_val && row.old_val.profile && row.new_val.profile) { |
/** | |
* Created by fipso on 13.10.16. | |
*/ | |
const CryptoJS = require('crypto-js'); | |
const request = require('request-promise-native'); | |
const TelegramBot = require('node-telegram-bot-api'); | |
const bot = new TelegramBot('TOKEN', {polling: true}); |
I hereby claim:
To claim this, I am signing this object:
Make config file:
sudo nano /etc/nginx/sites-available/bot.conf
Then copy and paste bot.conf
content and edit YOUR.DOMAIN strings. Now install Let's Encrypt on your server. For example in Debian you need to add jessie-backports
and easily install it with apt-get
:
sudo apt-get install -t jessie-backports letsencrypt
Then get cert for you domain:
sudo apt-get update | |
sudo apt-get install -t jessie-backports letsencrypt | |
sudo letsencrypt certonly --standalone --email [email protected] -d example.com --rsa-key-size 4096 | |
sudo openssl dhparam -dsaparam -out /etc/letsencrypt/live/example.com/dhparam.pem 4096 | |
# '-dsaparam' key for very fast gen |
sudo letsencrypt certonly --standalone --email [email protected] -d kraso.xyz --rsa-key-size 4096 | |
sudo openssl dhparam -dsaparam -out /etc/letsencrypt/live/kraso.xyz/dhparam.pem 4096 | |
## | |
# SSL Settings | |
## | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_session_cache shared:SSL:10m; |
#!/bin/bash | |
# Trap Ctrl+C interupt | |
trap finish INT | |
exec_cmd_nobail() { | |
bash -c "$1" | |
} | |
exec_cmd() { |