This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
data = {'question': 'Это животное?', True: 'кошка', False: 'компьютер'} | |
def ask(q): | |
a = raw_input(q) | |
if a in 'y': | |
return True | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <string.h> | |
const char FILTER[] = "Internet Explorer"; | |
BOOL CALLBACK CloseWindow(HWND h, LPARAM lparam) | |
{ | |
char buff [256]; // I know, I know... | |
GetWindowText(h, (LPTSTR)buff, 256); | |
if(strstr(buff, FILTER) != NULL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ -lao -o beep beep.cpp | |
#include <ao/ao.h> | |
#include <cmath> | |
#include <cstdlib> | |
#define BITS 16 | |
#define CHANNELS 1 | |
#define RATE 22050 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 150% fullscreen | |
EVEN_UP_CROP=179 | |
ODD_DOWN_CROP=16 | |
#result | |
SIZE=918x1192 | |
SHIFT=+215+138 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
PREFIX=2008 | |
FROM='/media/vadim/Data/Фотографии' | |
for dir in $FROM/$PREFIX*; | |
do | |
echo -n "$dir" ... | |
dirname=$(basename "$dir") | |
tar c -C "$FROM" $dirname | gpg -e -r "Vadim Velikodniy" -o "$dirname.tar.gpg"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pyopencl as cl | |
N = 1000000 | |
a_np = np.random.rand(N).astype(np.float32) | |
b_np = np.random.rand(N).astype(np.float32) | |
ctx = cl.create_some_context(answers=['0']) | |
queue = cl.CommandQueue(ctx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.linux.org.ru/forum/development/12574505 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.*; | |
import java.io.*; | |
import java.util.*; | |
public class Client { | |
static int port = 5003; // Порт, такой же, как у сервера | |
static String address = "127.0.0.1"; // Адрес сервера | |
public static void main(String[] args) { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from torch import Tensor | |
import torch.nn as nn | |
import torch.nn.functional as F | |
class Sharpness(nn.Module): | |
def __init__(self): | |
super().__init__() | |
kernel = [[-1, -1, -1], [-1, 8, -1], [-1, -1, -1]] | |
kernel = Tensor(kernel) | |
kernel.unsqueeze_(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numba as nb | |
jit = nb.njit(parallel=True, fastmath=True) | |
@jit | |
def v(x): | |
return np.array(x, dtype=np.float64) |
OlderNewer