Skip to content

Instantly share code, notes, and snippets.

View stokito's full-sized avatar
Self-hosting become easier 🤗

Sergey Ponomarev stokito

Self-hosting become easier 🤗
View GitHub Profile
@samueltcsantos
samueltcsantos / ArrayListTest.java
Created February 5, 2015 04:13
Testing the ArrayList implementation.
package adt.list;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
/**
* Testing the ArrayList implementation.
@stokito
stokito / BeerSpec.groovy
Created November 17, 2014 17:10
Test task
import spock.lang.Specification
import spock.lang.Unroll
/**
A programmer drinks exactly goalPints of beer every evening.
One evening, the programmer opens his fridge and sees a number of smallBottles of beer (1 pint each) and a number of bigBottles of beer (3 pints each).
The programmer needs to decide whether he can pick some bottles and start drinking, or has to run to the store to buy some more bottles.
The programmer is "greedy" and never consumes a bottle partially.
Write a Java-method which returns true if it is possible to make the goal by choosing from the given (whole) bottles, or false otherwise.
Note that it is not necessary to "take" all bottles — some may remain unused.
@ttaubert
ttaubert / onion-gen.js
Created November 2, 2014 13:14
Generating custom .onion names with the WebCrypto API
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/*
* thirty-two
* https://github.com/chrisumbel/thirty-two
*
@artyom
artyom / result.txt
Created July 10, 2014 14:39
Golang XOR performance for 8/64 bytes long integers
$ go test -bench .
PASS
Benchmark8 1000000 1093 ns/op 936.69 MB/s
Benchmark64 20000000 134 ns/op 7603.74 MB/s
ok _/private/tmp/x 3.944s
@jppommet
jppommet / bcm4352-wifi-ac.md
Created July 4, 2014 20:03
Linux Ubuntu Drivers for Broadcom Chipset BCM4352 802.11ac Wireless Network Adapter [14e4:43b1]
@Dierk
Dierk / ModularGroovyTraits
Created April 6, 2014 19:23
Using modular traits in Groovy 2.3.0-beta-1
trait HasId {
long id
}
trait HasVersion {
long version
}
trait Persistent {
boolean save() { println "saving ${this.dump()}" }
}
trait Entity implements Persistent, HasId, HasVersion {
@niquola
niquola / list.md
Last active May 20, 2018 04:52
Must Read from Ravil Bayramgalin (https://github.com/brainopia) + my small adds :)

Books

Concepts-Techniques-Models-Computer-Programming CMT это известная книжка CMT, за которой слава закрепилась не хуже чем у SICP

это из этой книжки классификация различных парадигм Если присмотришься, то увидишь, что Oz поддерживает большинство вариаций (с этой целью его и конструировали, чтобы можно было наглядно продемонстрировать различные подходы в одном языке)

@drmalex07
drmalex07 / build-deb-package.md
Last active January 18, 2025 21:46
A simple HowTo build a debian source package. #debian

Create a debian package

Prereqs

Install debian maintainer's toolset:

apt-get install devscripts dh-make

Create skeleton directory

@atenni
atenni / README.md
Last active May 5, 2025 08:06
How to permalink to a gist's raw file

Problem: When linking to the raw version of a gist, the link changes with each revision.

Solution:

To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/

To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]

@guettli
guettli / gist:3884560
Created October 13, 2012 12:54 — forked from evoL/gist:1650115
Gtk Multi Autocomplete
import pygtk
pygtk.require("2.0")
import gobject
import gtk
from gtk import gdk
class EntryMultiCompletion(gtk.Entry):
def __init__(self):
gtk.Entry.__init__(self)