Skip to content

Instantly share code, notes, and snippets.

View eremeevdev's full-sized avatar

Aleksey Eremeev eremeevdev

View GitHub Profile
for product in PhpStorm WebStorm DataGrip IntelliJIdea CLion PyCharm GoLand RubyMine; do
echo "Resetting evaluation period for $product..."
rm ~/Library/Application\ Support/JetBrains/$product*/eval/*.evaluation.key
rm ~/Library/Application\ Support/JetBrains/$product*/options/other.xml
done
rm ~/Library/Preferences/jetbrains.*
@kyle-eshares
kyle-eshares / models.py
Created October 15, 2016 18:01
Strict ForeignKeys
from __future__ import unicode_literals
from django.db import models
from django.db.models.fields.related_descriptors import ForwardManyToOneDescriptor # noqa
class RelationNotLoaded(Exception):
pass
@gdamjan
gdamjan / aiohttp-server.py
Last active October 2, 2021 15:29
Example: asyncio and aiohttp, handling longpoll, eventsource and websocket requests with a queue and background workers
from aiohttp import web
from threading import Thread
import asyncio
import time, uuid
loop = asyncio.get_event_loop()
def long_blocking_thing(sleep):
time.sleep(sleep)
return 42
anonymous
anonymous / card.xml
Created February 27, 2014 21:00
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle"
android:dither="true">
<corners android:radius="2dp"/>
<solid android:color="#CCC" />
</shape>
</item>
<item android:bottom="2dp">
@quilime
quilime / htmlwordcount.py
Last active December 16, 2015 10:58
Count words from html
import nltk
import string
from urllib import urlopen
from itertools import imap
url = "http://google.com"
html = urlopen(url).read()
text = nltk.clean_html(html)
text_noPunc = text.translate(string.maketrans("",""), string.punctuation)
words = text_noPunc.split()
@ratpik
ratpik / HTTP Post Android to Django Tastypie
Created March 24, 2013 17:36
This describes a way to submit HTTP POST in a way the REST interface provided by Tastypie to Django understands it for JSON data
//Creating the data to be sent, note the escaped quotes that are required
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(3);
nameValuePairs.add(new BasicNameValuePair("\A\"", "\"/api/v1/a/1/\""));
nameValuePairs.add(new BasicNameValuePair("\"B\"", "\"/api/v1/b/1/\""));
nameValuePairs.add(new BasicNameValuePair("\"C\"", "\"Hello from Android\""));
@wontondon
wontondon / AssetDatabaseOpenHelper.java
Created October 8, 2011 03:12
Copy sqlite database from assets dir - Android
package com.javatarts.basketballgm.data;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;