Skip to content

Instantly share code, notes, and snippets.

@Vftdan
Vftdan / pal2gpl.py
Created Aug 9, 2019
Convert pal to gpl palette
View pal2gpl.py
#! /usr/bin/env python3
input() #header
input() #version
cnt = int(input()) #number of colors
print("GIMP Palette")
print("Columns: {0}".format(cnt))
print("#")
for i in range(cnt):
print("{0} {1} {2}\tUntitled".format(*(input().split())) + str(i + 1))
@Vftdan
Vftdan / toggleMicOneLiner.sh
Last active Jan 7, 2019 — forked from nikhilw/toggleMicOneLiner.sh
Toggle mic on-off on a Ubuntu / Linux Mint machine with a keyboard shortcut
View toggleMicOneLiner.sh
#! /bin/sh
# static icon, easier to set as a bash alias or directly use as a single command instead of creating a script file.
amixer -D pulse set Capture toggle | gawk 'match($0, /(Front Left|Mono).*\[(.*)\]/, a) {print a[2]}' | xargs notify-send --hint=int:transient:1 -i "audio-input-microphone" "Mic switched: $1"
View hse_logo.gcode
M107
M104 S200
G28
G1 Z5 F250.0
M109 S200
G21
@Vftdan
Vftdan / toggleSide
Created Nov 23, 2018
"javascript:" bookmarks for vk.com
View toggleSide
javascript:void%28%28document.getElementById%28%22side_bar%22%29.style.display%3Ddocument.getElementById%28%22side_bar%22%29.style.display%3D%3D%22none%22%3F%22block%22%3A%22none%22%29%5E%28document.getElementById%28%22page_body%22%29.style.float%3Ddocument.getElementById%28%22side_bar%22%29.style.display%3D%3D%22none%22%3F%22none%22%3A%22right%22%29%29
View button.gcode
F60
G0 X11.0
G2 X11.0 Y22.0 I0.0 J11.0
G2 X11.0 Y0.0 I-0.0 J-11.0
G0 Z0.1
G2 X11.0 Y22.0 I0.0 J11.0
G2 X11.0 Y0.0 I-0.0 J-11.0
G0 Z0.2
G2 X11.0 Y22.0 I0.0 J11.0
G2 X11.0 Y0.0 I-0.0 J-11.0
View soap-container-manual.gcode
G0 X2 Y8 Z0
G1 F60 E.0024
(M98 P1 L30)
G91
G1 X4
G1 Y-.1
G1 X-4
G1 Y-.1
G1 X4
@Vftdan
Vftdan / Func8.tsv
Last active Dec 8, 2018
Turing Machine program for function F(A, B, C) = A and (B equiv C)
View Func8.tsv
Q\A _ * 0 1 x Комментарии
IN halt * l q1 0 l q1 1 l q1
q1 * r LP
LP _ l q2 * r LP 0 r LP 1 r LP x r LP
q2 * n C0 _ l C0 _ l C1
C0 * l q3 0 l C0 1 l C0
q3 * n D1 x l D1 x l D0 x l q3
C1 * l q4 0 l C1 1 l C1
q4 * n D0 x l D0 x l D1 x l q4
D0 * l q5 0 l D0 1 l D0
@Vftdan
Vftdan / turingm.py
Created Nov 8, 2018
Turing machine interpreter. Usage: `python turingm.py program.tsv inputs.txt`
View turingm.py
import sys
class ParsingException(BaseException):
pass
class TuringException(BaseException):
pass
header = None
data = dict()
dataptr = 0
states = dict()
stateptr = None
View mathcad_L1_a_c.xmcd
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?validation-md5-digest 17f0e79d174143dc72e8ed7517deb334?>
<worksheet version="3.0.3" xmlns="http://schemas.mathsoft.com/worksheet30" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ws="http://schemas.mathsoft.com/worksheet30" xmlns:ml="http://schemas.mathsoft.com/math30" xmlns:u="http://schemas.mathsoft.com/units10" xmlns:p="http://schemas.mathsoft.com/provenance10">
<pointReleaseData/>
<metadata>
<generator>Mathcad Professional 14.0</generator>
<userData>
<title/>
<description/>
<author>Пользователь Windows</author>
View soap-container.scad
//by Vftdan
module detSphere(radius, details=1) scale(1 / details) sphere(radius * details);
module zcyl(h, r, details) scale(1 / details) cylinder(h * details, r=r * details, center=true);
module xcyl(h, r, details) rotate([0, 90, 0]) zcyl(h, r, details);
module ycyl(h, r, details) rotate([90, 0, 0]) zcyl(h, r, details);
module bottomSmoothedCuboid(width, depth, height, radius, details=1) {
d = radius * 2;
intersection() {
translate([0, 0, height / 2]) {