Skip to content

Instantly share code, notes, and snippets.

View chuckis's full-sized avatar
🔍
In the beginning was the Word,

chuckis

🔍
In the beginning was the Word,
  • 09:38 (UTC +02:00)
View GitHub Profile
@chuckis
chuckis / cannonballs.py
Created May 10, 2017 21:04
задача о ядрах
# 1.Cannonballs
#
# A new kind of cannon is being tested. The cannon shoots cannonballs in a fixed direction. Each cannonball flies horizontally until it hits the ground, and then it rests there. Cannonballs are shot from different heights, so they hit the ground at different points.
# You are given two zero-indexed arrays, A and B, containing M and N integers respectively. Array A describes the landscape in the direction along which the cannon is shooting. Elements of array A represent the height of the ground, going from the cannon outwards. Array B contains levels from which consecutive cannonballs are shot.
# Assume that a cannonball is shot at level H.
# Let I be the smallest index, such that 0 < I < M and A[I] ≥ H. The cannonball falls at position I − 1 and increases the ground level A[I−1] by 1.
# If there is no such I, and H > A[I] for all 0 ≤ I < M, then the cannonball flies beyond the horizon and has no effect on the result.
# If H ≤ A[0], then the cannonball ricochets away and has no effect on the
@chuckis
chuckis / jackdrc
Created July 18, 2016 04:47
jackdrc
/usr/bin/jackd -P1 -dalsa -dhw:0 -r44100 -p1024 -n2 psuspender --jackd
//Enter OpenSCAD code here.
module 200_balka(){
translate ([0, 0, 10])cube([10, 10, 200]);
}
module 125_balka(){
rotate([90, 0, 90]) cube([10, 10, 125]);
}
module 240_balka(){
@chuckis
chuckis / inner-pad.scad
Created June 1, 2016 16:34
part of all-pad
// inner-pad.scad
//lad-cube.scad
module one-romb() {
scale ([1, 0.7, 1]) rotate ([45, 0, 0]) cube([30, 1, 1], center=true);
}
//lad-rombs.scad
module lad-rombs() {
for(i= [1 : 30]){
translate ([0, i - (i * 0.3), 0]) one-romb();
@chuckis
chuckis / rombos.scad
Created June 1, 2016 15:30
part of inner pad
module one-romb() {
scale ([1, 0.7, 1]) rotate ([45, 0, 0]) cube([30, 1, 1], center=true);
}
//lad-rombs.scad
module lad-rombs() {
for(i= [1 : 30]){
union(){translate ([0, i - (i * 0.3), 0]) one-romb();}
}
}
//vneshnii kontur
CIRCLE_R =8.25;
SQUARE_H = 14;
SQUARE_W = 16.5;
l=8;
LENGTH = 21.5;
TRANSLATE_Y = LENGTH - CIRCLE_R - SQUARE_H * 0.5;
module vneshnii_pad(){
@chuckis
chuckis / diamond.scad
Created May 31, 2016 20:03
pattern of lad-pad.
module romb() {
scale ([1, 1, 1]) rotate ([20, 0, 0]) cube([5, 3, 1], center=true);
}
//diamond_rombs.scad
module diamond(){
rotate ([0, 0, -45]) {
for(i= [0 : 3]){
union(){ translate ([0, i - (i * 0.3), 0]) scale ([1, 1.2, 0.6]) romb();}
@chuckis
chuckis / upper-cube.scad
Created May 30, 2016 16:38
upper cube from lad-pad
//upper-cube.scad
INCL = 3.2; // inner cube length
INCW = 2; // inner cube width
INCH = 2; // inner cube height
THIKNESS = 0.9;
OCL = INCL + THIKNESS * 2 ; // outer cube length
@chuckis
chuckis / stavka.scad
Created May 29, 2016 18:06
part of lad-pad
//stavka.scad
module stavka() {
difference (){
translate ([0, 0, -10]) cube ([20, 20, 20], center=true);
union (){
for (rot = [[0, 90, 0], [90, 0, 0], [0, 0, 90]]){ rotate(rot) cylinder(r= 6.5, h=50, fa = 20, center = true);}
}
}
}
@chuckis
chuckis / fnkon.scm
Last active February 19, 2016 16:30
knight tour in Lispme's scheme
;fnkon'
(define (filter f l)
(if (null? l) '()
(let ((x (car l))
(r (filter f (cdr l))))
(if (f x) (cons x r) r))))
(define (map f l)
(letrec ((result (cons '() '()))
(helper (lambda (p l)