Skip to content

Instantly share code, notes, and snippets.

@antishok
antishok / deploy-discord-command.js
Created December 25, 2022 04:16
discord command
const { ContextMenuCommandBuilder } = require('@discordjs/builders');
const { REST } = require('@discordjs/rest');
const { Routes, ApplicationCommandType } = require('discord-api-types/v9');
const config = require('./config/local.json');
const commands = [
new ContextMenuCommandBuilder()
.setName('Is user online?')
.setType(ApplicationCommandType.Message),
]
@antishok
antishok / CommentReplyField.jsx
Created December 24, 2021 01:01
react-activity-feed Comment Reply Field
import React, { useRef, useState, useEffect } from 'react';
import classNames from 'classnames';
import { useFeedContext, useTranslationContext, Textarea, Button, Avatar } from 'react-activity-feed';
export const CommentReplyField = ({
comment,
emojiData,
onSuccess,
image,
@antishok
antishok / react-native-fetch.js
Created October 18, 2019 22:07
react-native fetch example
const config = require('../config');
async function ajax(path, data, {timeout} = {}) {
const opts = {
method: data ? 'POST' : 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
credentials: 'same-origin'
@antishok
antishok / index.js
Created August 18, 2019 21:11
express-ws session example
const path = require('path');
const express = require('express');
const expressWs = require('express-ws');
const bodyParser = require('body-parser');
const expressSession = require('express-session');
const KnexSessionStore = require('connect-session-knex')(expressSession);
const passport = require('passport');
const app = express();
import numpy as np
import sys
from keras.models import Model
from keras.layers import Input, Dense, Activation, Embedding, LSTM, RepeatVector
from keras.layers.normalization import BatchNormalization
from keras.layers.wrappers import TimeDistributed
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras import optimizers
@antishok
antishok / Caddyfile
Last active March 22, 2019 16:49
caddy tls config for old android
tls admin@mysite.com {
protocols tls1.0 tls1.3
ciphers ECDHE-RSA-AES128-GCM-SHA256 ECDHE-ECDSA-WITH-CHACHA20-POLY1305 ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES128-CBC-SHA ECDHE-ECDSA-AES256-CBC-SHA ECDHE-RSA-AES256-CBC-SHA
}
@antishok
antishok / scenaric-sf-package-post-install.md
Created November 21, 2017 22:59
Scenaric salesforce package post-install instructions

Before using the Scenaric Salesforce app, the administrator must authorize use of the app for certain profiles, users, or permission sets.

To achieve this, we recommend the following steps:

  • In Setup, go to Manage Apps -> Connected Apps
  • Click "Edit" next to "ScenaricCanvas" app
  • Change the "Permitted Users" setting to "Admin approved users are pre-authorized"
  • Ignore the warning, then click Save
  • Click the ScenaricCanvas app, then scroll down and click "Manage Profiles"
  • Select for example "System Administrator" and "Standard User", and click Save
@antishok
antishok / generate.py
Last active November 17, 2017 17:20
keras stateful lstm - word-level rnn
import numpy as np
import sys
from keras.models import Sequential
from keras.layers import Dense, LSTM, Embedding, Activation
from keras.layers.wrappers import TimeDistributed
from keras import backend as K
from utils import Data, weighted_sample
@antishok
antishok / generate.py
Created November 11, 2017 00:08
keras stateful lstm
import numpy as np
import sys
from keras.models import Sequential
from keras.layers import Dense, Dropout, LSTM, Embedding, Lambda, Activation
from keras.layers.wrappers import TimeDistributed
from keras import backend as K
filepath = 'input.txt'
weights_file = 'model.best.h5'
<html>
...
<script>
fetch('/ping')
.then((response) => response.json())
.then((data) => {
console.log('pong', data);
});
</script>