Skip to content

Instantly share code, notes, and snippets.

{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "http://example.com/example.json",
"type": "object",
"title": "The root schema",
"description": "The root schema comprises the entire JSON document.",
"default": {},
"examples": [
{
"series": "0000",
#!/usr/bin/env python
from django.core.management.utils import get_random_secret_key
if __name__ == "__main__":
with open(".env", "w") as env_file:
env_file.write("""DEBUG=on
SECRET_KEY={}
ALLOWED_HOSTS=*
DATABASE_URL=postgresql://django:django@localhost:5432/db
"""
Quick dog-piling (aka stampeding herd) URL stresstest
https://www.peterbe.com/plog/quick-dog-piling-url-stresstest
"""
import random
import time
import requests
import concurrent.futures
@Marakuba
Marakuba / vons-select-component.vue
Created June 28, 2018 16:10 — forked from marcusvbp/vons-select-component.vue
A v-ons-select (Onsen UI + Vue) alternative
<template>
<div class="vons-select">
<v-ons-button modifier="quiet" @click="dialog = true">
<span v-if="value.length > 0">{{ value }}</span>
<span v-else>{{ label }}</span>
<span class="arrow">&dtrif;</span>
</v-ons-button>
<v-ons-alert-dialog cancelable modifier="rowfooter" :visible.sync="dialog" class="vons-select-dialog">
<span slot="title">{{ label }}</span>
public class DistanceAlferov {
class Word {
public string Text { get; set; }
public List<int> Codes { get; set; } = new List<int>();
}
class AnalizeObject {
public string Origianl { get; set; }
public List<Word> Words { get; set; } = new List<Word>();
}
class LanguageSet {
CORS_REPLACE_HTTPS_REFERER = False
HOST_SCHEME = "https://"
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_SECONDS = 1000000
SECURE_FRAME_DENY = True
import app = require("application");
import platform = require("platform");
declare var android: any;
if(!!app.android){
app.android.on(app.AndroidApplication.activityResumedEvent, function (args) {
console.log("Event: " + args.eventName + ", Activity: " + args.activity);
console.log(new String(args.activity.getIntent().getAction()).valueOf(), new String(android.content.Intent.ACTION_VIEW).valueOf());
if(new String(args.activity.getIntent().getAction()).valueOf() == new String(android.content.Intent.ACTION_VIEW).valueOf()){
@Marakuba
Marakuba / django_auth_log.py
Created March 24, 2017 11:51
Django Auth Log
# http://stackoverflow.com/a/37620866
import logging
from django.contrib.auth.signals import user_logged_in, user_logged_out, user_login_failed
from django.dispatch import receiver
log = logging.getLogger(__name__)
@receiver(user_logged_in)
def user_logged_in_callback(sender, request, user, **kwargs):
@Marakuba
Marakuba / recover_source_code.md
Created March 20, 2017 12:54 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
var path = require("path");
var webpack = require('webpack');
module.exports = {
entry: {
"react": "./src/react.js",
"vue": "./src/vue.js"
},
output: {
filename: "[name].js",