Skip to content

Instantly share code, notes, and snippets.

View Gasoid's full-sized avatar
🏠
Working at home

Rinat Gasoid

🏠
Working at home
  • IFM
  • Wurzburg
  • 21:24 (UTC +02:00)
View GitHub Profile
package main
import (
"bufio"
"io/ioutil"
"os"
"strconv"
)
const (
package main
func main() {
}
func Merge2Channels(f func(int) int, in1 <-chan int, in2 <-chan int, out chan<- int, n int) {
go func(f func(int) int, in1 <-chan int, in2 <-chan int, out chan<- int) {
done := make(chan bool, n*2)
results := make([]*int, n*2)
def read_file_by_chunks(filename):
chunk_size = 9+1
with open(filename) as f:
read_bytes = 0
while True:
chunk = f.read(chunk_size)
chunk = chunk.strip()
if not chunk:
break
if '\n' in chunk:
@Gasoid
Gasoid / main.go
Last active May 17, 2020 08:39
sum of two large numbers
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
class City(models.Model):
name = models.CharField(max_length=255)
class Person(models.Model):
city = models.ForeighKey(City)
first_name = models.CharField(max_length=255)
last_name = models.CharField(max_length=255)
def net_mask(cidr):
cidr, mask = cidr.split('/')
mask = int(mask)
bin_mask_str = mask * '1' + (32 - mask) * '0'
mask_lst = [int(bin_mask_str[n*8:(n+1)*8], 2) for n in range(4)]
net_addr = []
broadcast = []
for oct in zip(cidr.split('.'), mask_lst):
# -*- coding: utf-8 -*-
import re
s = re.compile(r"\[(id\d+)\|(.*)\]")
r = s.search("[id12345678|Саша], бла бал балв выф пв пвыавыфавы аыфа")
print "id %s" % r.group(1)
print "name %s" % r.group(2)
@media screen and (max-width: 980px) {
.block { position: static }
.tower {color: red}
}
@Gasoid
Gasoid / form.html
Last active December 14, 2015 01:29
Пример, формы
<!-- 99% форм так делаются-->
<form>
<input value="" type="text" placeholder="поиск..."/>
<!-- Это кнопка -->
<input type="submit" value="Найти"/>
</form>