Skip to content

Instantly share code, notes, and snippets.

View dotcypress's full-sized avatar

Vitaly Domnikov dotcypress

View GitHub Profile
@dotcypress
dotcypress / wit-telegram-bot.js
Last active February 2, 2022 07:14
How to build Telegram bot with Wit.ai Bot Engine
// npm install telegraf telegraf-wit
var Telegraf = require('telegraf')
var TelegrafWit = require('telegraf-wit')
var app = new Telegraf(process.env.BOT_TOKEN)
var wit = new TelegrafWit(process.env.WIT_TOKEN)
app.use(Telegraf.memorySession())
@dotcypress
dotcypress / s3.sh
Created July 23, 2016 00:55 — forked from chrismdp/s3.sh
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@dotcypress
dotcypress / ◢◤.zsh-theme
Last active January 16, 2022 23:31
◢◤
GREEN="%{$fg_bold[green]%}"
YELLOW="%{$fg_bold[yellow]%}"
CYAN="%{$fg_bold[cyan]%}"
RED="%{$fg_bold[red]%}"
MAGENTA="%{$fg[magenta]%}"
RESET="%{$reset_color%}"
PROMPT='$RED◢◤ $CYAN%c $YELLOW$(git_prompt_info)$(git_prompt_status)$RESET'
RPROMPT='$MAGENTA%~ $RESET'
@dotcypress
dotcypress / now.plugin.zsh
Last active November 26, 2022 19:12
zsh autocomplete plugin for △ now
_now_commands ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
":command:->command"\
"*::options:->options"
case $state in
@dotcypress
dotcypress / keybase.md
Last active January 6, 2017 18:36
My publicly-auditable identity

Keybase proof

I hereby claim:

  • I am dotcypress on github.
  • I am dotcypress (https://keybase.io/dotcypress) on keybase.
  • I have a public key whose fingerprint is 9F83 5882 AEEA B17D B12C 78DE D844 1EF8 F3DF 1924

To claim this, I am signing this object:

@dotcypress
dotcypress / test.txt
Created September 28, 2016 18:03
Unicode test
1. 👩‍👩‍👧‍👦
2. ❤️
3. 👍🏽
@dotcypress
dotcypress / urm.rs
Created October 15, 2017 05:26
Unlimited Register Machine
//! Unlimited Register Machine
//! https://proofwiki.org/wiki/Definition:Unlimited_Register_Machine
use std::collections::HashMap;
type Address = usize;
type State = HashMap<Address, usize>;
#[derive(Debug)]
enum Op {
@dotcypress
dotcypress / flutures-micro.js
Last active February 2, 2018 20:08
ZEIT's Micro meets Futures
const { readFile } = require('fs')
const { isFuture, node, encase, after } = require('fluture')
const futurize = (handler) => async (req, res) => {
const result = await handler(req, res)
return isFuture(result) ? result.promise() : result
}
module.exports = futurize(
async (req, res) => {
@dotcypress
dotcypress / telegram-login.js
Created February 24, 2018 08:34
Telegram authorization data checker
const { createHash, createHmac } = require('crypto')
function checkSignature (token, { hash, ...data }) {
const secret = createHash('sha256')
.update(token)
.digest()
const checkString = Object.keys(data)
.sort()
.map(k => `${k}=${data[k]}`)
.join('\n')
use byteorder::{BigEndian, ByteOrder};
use eeprom24x::{ic, Eeprom24x, SlaveAddr};
use hal::hal::blocking::delay::DelayMs;
use hal::hal::blocking::i2c::{Write, WriteRead};
use hash32::{Hasher, Murmur3Hasher};
// EEPROM: 512 pages * 32 bytes = 16,384 bytes
// Index size: 32 pages * 8 refs = 256 slots
// Max key size: 12 bytes
// Max record size: 4095 bytes