Skip to content

Instantly share code, notes, and snippets.

View yerkbn's full-sized avatar
🎯
Focusing

yerkbn

🎯
Focusing
  • «JIGI» LLP
  • Almaty
View GitHub Profile
@springmeyer
springmeyer / degress2meters.js
Last active July 3, 2024 12:18
convert from long/lat to google mercator (or EPSG:4326 to EPSG:900913)
// See https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames for more details.
var degrees2meters = function(lon,lat) {
var x = lon * 20037508.34 / 180;
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
y = y * 20037508.34 / 180;
return [x, y]
}
x= -77.035974
import csv
class Grid(object):
'''Parses a csv file into a grid. Each cell in the grid is a list of strings, corresponding to
the string that was in the corresponding cell in the spreadsheet split by the given
'cell_item_separator', which defaults to a comma'''
def __init__(self, csv_text, width=0, height=0, cell_item_separator=','):
lines = list(csv.reader(csv_text.splitlines()))
self.height = height if height > 0 else len(lines)
@wesbos
wesbos / tab-trigger.js
Created November 16, 2015 19:33
How to properly get a TAB trigger working with Emmet inside of JSX
{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
// put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [
{
@cb109
cb109 / authentication.py
Last active January 25, 2023 08:42
Setting up DRF Token authentication with basic expiration
from datetime import timedelta
from django.conf import settings
from django.utils import timezone
from rest_framework.authentication import TokenAuthentication
from rest_framework.authtoken.models import Token
from rest_framework.exceptions import AuthenticationFailed
def is_token_expired(token):
import cv2
import numpy as np
import os
from random import shuffle
from tqdm import tqdm
TRAIN_DIR = '/home/yerkebulan/app/dev/projects/classification_research/dogs-vs-cats/train'
TEST_DIR = '/home/yerkebulan/app/dev/projects/classification_research/dogs-vs-cats/test1'
IMG_SIZE = 50
LR = 1e-3