Skip to content

Instantly share code, notes, and snippets.

{
"git.enableSmartCommit": true,
"git.confirmSync": false,
"git.autofetch": true,
"editor.tabSize": 2,
"[python]": {
"editor.tabSize": 4
},
"files.eol": "\n",
"editor.rulers": [
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <string>
#define let const auto
#define CUBE_COUNT 28
using std::cin;
using std::cout;
@kraftwerk28
kraftwerk28 / tgbot-ddos-solve.js
Created February 12, 2019 22:56
U know whit it is for...
// eating old updates
(async () => {
if (bot.hasOpenWebHook()) {
await bot.deleteWebHook()
}
let lastUpdateID = 0
lastUpdateID = await bot.getUpdates({})
.then(updates => updates[updates.length - 1].update_id)
const recursiveReq = async () => {
'use strict';
/**
* Binds function to positioned arguments
* posargs must be like { 2: one_arg, 100: another_arg, 0: another_arg }
* @param {Function} fn
* @param {Object} posargs
*/
const positionalBind = (fn, posargs) => (...args) => {
const indexes = Object.keys(posargs).map(_ => +_).sort();
function _brc_parse_git_branch_ {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
echo "(${BRANCH})"
fi
}
function _brc_parse_branch_status_ {
if [[ $(git status --short) ]]
@kraftwerk28
kraftwerk28 / ae.js
Last active June 6, 2019 01:13
AsyncEmitter
'use strict';
const AsyncEmitter = () => ({
_events: {},
on(name, f) {
!Object.keys(this._events).includes(name) &&
(this._events[name] = []);
if (this._events[name].find(fn => fn.source === f || fn === f)) return;
this._events[name].push(f);
},
@kraftwerk28
kraftwerk28 / main.c
Last active July 3, 2019 20:59
Matrix in single piese on memoty (almost)
#include <stdio.h>
#include <stdlib.h>
#define PTR_SZ sizeof(void*)
#define INT_SZ sizeof(int)
struct monomtx;
int mmtx_get(struct monomtx*, int, int);
void mmtx_set(struct monomtx*, int, int, int);
@kraftwerk28
kraftwerk28 / Dockerfile
Created November 14, 2019 17:46
node:alpine vs node:slim
FROM node:slim
WORKDIR /opt/app
COPY ./ ./
EXPOSE 8080
CMD node ./