Skip to content

Instantly share code, notes, and snippets.

a = input()
words = list(a)
bwt = []
for i in range(len(words)):
word = a[-1] + a[:-1]
new = ''.join(word)
a = new
bwt.append(new)
i += 1
@gmyrianthous
gmyrianthous / linked_list.py
Last active February 26, 2022 23:36
User Defined Classes for Linked Lists in Python
class Node:
def __init__(self, value, next_node=None, prev_node=None):
self.value = value
self.next = next_node
self.prev = prev_node
def __str__(self):
return str(self.value)
@MarZab
MarZab / api-filter-query.ts
Last active August 2, 2024 16:04
NestJS Filters with Swagger deepObject (example: `?filters[name]=thing1&filters[description]=thing2`)
import { applyDecorators } from '@nestjs/common';
import { ApiExtraModels, ApiQuery, getSchemaPath } from '@nestjs/swagger';
/**
* Combines Swagger Decorators to create a description for `filters[name]=something`
* - has support for swagger
* - automatic transformation with nestjs
*/
// eslint-disable-next-line @typescript-eslint/ban-types,@typescript-eslint/explicit-module-boundary-types
export function ApiFilterQuery(fieldName: string, filterDto: Function) {
@uniconstructor
uniconstructor / jupyter.md
Last active November 2, 2019 17:02
Jupyter Notebook Setup
@ZempTime
ZempTime / xstate-getting-started.md
Last active September 12, 2019 07:25
Statechart doc example

Thinking in State Charts

  1. Determine your states
  2. Determine your events
  3. Determine your side effects (resulting changes in state)

You can store information in two ways:

  • State nodes (each state node can have one value)
  • Context (can hold arbitrary values because js object)
@justinatack
justinatack / Quasar Framework Dark Theme Login Form Card Component
Created April 17, 2019 08:14
Quasar Framework Dark Theme Login Form Card Component
<template>
<q-page
class="window-height window-width row justify-center items-center"
style="background: linear-gradient(135deg, #EA5C54 0%,#bb6dec 100%);"
>
<div class="column">
<div class="row">
<q-card square dark class="q-pa-md q-ma-none no-shadow bg-grey-10" style="width:320px;">
<q-card-section class="q-mt-xl q-mb-md">
<p class="text-weight-bolder text-grey">Login to your account</p>
@xenogenesi
xenogenesi / Makefile
Last active November 19, 2021 03:28
create self signed certificates
DOMAIN ?= mydomain.com
COUNTRY := IT
STATE := IT
COMPANY := Evil Corp.
# credits to: https://gist.github.com/fntlnz/cf14feb5a46b2eda428e000157447309
# usage:
@amano41
amano41 / xorshift.py
Created October 24, 2018 13:26
Xorshift and xorshift+ implementation in Python
def xorshift128():
'''xorshift
https://ja.wikipedia.org/wiki/Xorshift
'''
x = 123456789
y = 362436069
z = 521288629
w = 88675123
@snakers4
snakers4 / process_wikipedia.py
Last active January 4, 2023 22:19
Post process wikipedia files produced by wikiextractor
import os
import re
import sys
import glob
import nltk
import gensim
import numpy as np
import pandas as pd
from tqdm import tqdm
from uuid import uuid4
@uniconstructor
uniconstructor / queries.sql
Last active September 30, 2018 17:31
opencopora.org sources index
# все документы источника
SELECT * FROM `opencopora.ru`.books where parent_id=1;
# все id документов всех источников
SELECT book_id FROM `opencopora.ru`.books where parent_id=1
SELECT book_id FROM `opencopora.ru`.books where parent_id=8
SELECT book_id FROM `opencopora.ru`.books where parent_id=56
SELECT book_id FROM `opencopora.ru`.books where parent_id=184
SELECT book_id FROM `opencopora.ru`.books where parent_id=226
SELECT book_id FROM `opencopora.ru`.books where parent_id=806
SELECT book_id FROM `opencopora.ru`.books where parent_id=1651