Skip to content

Instantly share code, notes, and snippets.

View laserbat's full-sized avatar

Olga Ustiuzhanina laserbat

View GitHub Profile
@laserbat
laserbat / README.md
Last active September 23, 2023 14:13

To use this script

  1. Install xdotool: $ sudo apt install xdotool

  2. Install this script to /usr/local/bin: $ sudo cp path/to/file/permafocus.sh /usr/local/bin/ (path/to/file should be replaced by the actual path to the folder containing script, for example ~/Downloads/)

@laserbat
laserbat / flow3.c
Last active February 29, 2020 04:24
pulses (2) / flow (3)
// This file produces 44100 Hz, 2 channel, unsigned 8 bit raw PCM
// If you're on linux you can play it using aplay:
// $ ./flow3 | aplay -r44100 -c2
#include <stdio.h>
#include <stdint.h>
// I highly recommend playing with these constants as different values
// produces different timbres and different musical development.

Keybase proof

I hereby claim: * I am laserbat on github. * I am laserbat (https://keybase.io/laserbat) on keybase. * I have a public key ASC76xaqUF_Z6863ikh7Zl8ARuO0YWVU_G68fVICPK1t5go To claim this, I am signing this object:

{   "body": {     "key": {       "eldest_kid": "0120bbeb16aa505fd9ebceb78a487b665f0046e3b4616554fc6ebc7d52023cad6de60a",       "host": "keybase.io",       "kid": "0120bbeb16aa505fd9ebceb78a487b665f0046e3b4616554fc6ebc7d52023cad6de60a",       "uid": "d8884b594b097590ca426c39cc9df319",       "username": "laserbat"     },     "merkle_root": {       "ctime": 1575308373,       "hash": "8e4653a9d64d6363f97c4a410e30e535dd7b133d6a9885ed99d3c6a441b1c623db4d18f8b25a72b5d35626a577654c3e7bb2ff62479bc62706c28d3795a7b5d9",       "hash_meta": "9812ab4bc8456f212752904cf1fab72b6bef946e185bb6a6f8e2f72dea55b6f7",       "seqno": 11800916     },     "service": {       "entropy": "eKvQyaQxNIjIz4PXBsIKslAa",       "name": "github",       "username": "laserbat"     },     "type": "web_serv
#!/bin/bash
# ./bach.sh | aplay -r44100
SAMPLE_RATE=44100
A=(55 110 220 440 880)
A_sharp=(58 116 232 464 928)
B=(62 124 248 496 992)
C=(65 130 260 520 1040)
C_sharp=(69 138 276 552 1104)
D=(73 146 292 584 1168)
#!/bin/bash
x=1 y=1 z=1 o=$(xrandr|grep primary|cut -d' ' -f1)
f(){ bc<<<"scale=5;x=$1;y=($RANDOM/32767-0.5)/10;if(x+y>0.5&&x+y<1.5)x+=y;print x;";}
trap "xrandr --output \"$o\" --gamma '1:1:1'" EXIT
while true; do
x=$(f $x) y=$(f $y) z=$(f $z)
xrandr --output "$o" --gamma "$x:$y:$z"
sleep 0.1
done
#############################
#############################
######################...####
####.....######.........#####
##......####.#.........######
####....###..........########
#####..######################
#############################
#############################
|
def createCaveLevel(self, w, h):
"""
Simple CA cave generator, sometimes generates not-so-cavelike
levels :(
Uses algorithm from:
roguebasin.roguelikedevelopment.org/index.php?title=
Cellular_Automata_Method_for_Generating_Random_Cave-Like_Levels
"""
cave = [] # Level
#!/usr/bin/python
import math
def func(x, prec):
if (x + 0.5) == round(x + 0.5):
return x - 0.5
y = 0
for i in range(1, prec + 2):
y += ((-1)**i * math.sin(2 * i * x * math.pi)) / i
return x + (y / math.pi).real
###########################################################################################################################################################################################################################################################
###########################################################################################################################################################################################################################################################
####...#####...............#####........#############....#######..###....######..##########...##########################.....######.....##############..####......................###................####.......##########...##......#########...###....###
###.....###.................###..........###########......#####...........####....####..##.....#######...###########..........###........####...#####....##......................................................########.............#######............##
###............#
#################################################################################
###############...........#######.........########......######....#########...###
##############..............#####..........#####.........####......#######.....##
#############....#####.......####...........###....####...###..##...#####......##
#############....#####...##.#####............##...######...##..###..###.......###
#####....#####...####...#########............#...#######...##..###...#.......####
####........###...###..#########..###...##..##...######....##...........##..#####
####.........#....###..########..#####..##..###...####....####..............#####
####...............#...########..#####..##..####...##....#####......#........####
####.....###...........########..####..###..#####........####....#.....###....###