Skip to content

Instantly share code, notes, and snippets.

View dgladkov's full-sized avatar

Dmitry Gladkov dgladkov

  • Uber
  • San Francisco
View GitHub Profile
defmodule MyApp.User do
use MyApp.Web, :model
schema "users" do
field :email, :string
field :encrypted_password, :string
field :is_admin, :boolean, default: false
field :password, :string, virtual: true
timestamps
@dgladkov
dgladkov / .eslintrc.json
Last active October 2, 2018 15:03
My .eslintrc for react/react-native projects
{
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
server {
listen 443 ssl;
server_name example.com;
keepalive_timeout 70;
ssl_certificate crt.crt;
ssl_certificate_key key.key;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers kEECDH+AESGCM+AES128:kEECDH+AES128:kRSA+AESGCM+AES128:kRSA+AES128:!RC4:!aNULL:!eNULL:!MD5:!EXPORT:!LOW:!SEED:!CAMELLIA:!IDEA:!PSK:!SRP:!SSLv2;
@dgladkov
dgladkov / string_range.py
Created September 6, 2012 21:30
Generates string range, analog of Perl's `print "a".."azc"`
from itertools import product
def string_range(first, last):
"""
Generates string range, analog of Perl's `print "a".."azc"`
Usage: string_range('a', 'azc')
"""
def ascii_generator(letters):
"""
#!/bin/zsh
# my favorite apps to use
export EDITOR='/opt/local/bin/vim'
export BROWSER='open' # can be replaced by firefox or smt on Linux
# completion
fpath=(~/.zshfuncs $fpath)
autoload -U compinit
compinit
"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._
package haven;
import static haven.MCache.cmaps;
import static haven.MCache.tilesz;
import java.security.*;
import java.util.*;
import java.net.*;
import java.io.*;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import glob
import os
from PIL import Image
class MapRow(dict):
def __init__(self, map_obj, x_coord, *args, **kwargs):
super(MapRow, self).__init__(self, *args, **kwargs)
self.map = map_obj
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x0A)
{
"built-in",
Buffer (One)
{
0x01
},
Device (SATA)
{
Name (_ADR, 0x001F0002)
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"device-id",
Buffer (0x04)
{