Skip to content

Instantly share code, notes, and snippets.

Avatar
✳️
optimizing

Larry Holst Diicorp95

✳️
optimizing
View GitHub Profile
@Diicorp95
Diicorp95 / Quine.js
Last active Aug 18, 2022
A short Quine program in JavaScript
View Quine.js
function Q(){console.log(Q.toString()+'Q()');}Q()
@Diicorp95
Diicorp95 / byte_converter.py
Last active Jul 19, 2022 — forked from Pobux/byte_converter.py
Bytes converter python3. Convert bytes to KB, MB, GB, TB, PB and explanation on difference between byte, bit, kB, KiB, KB, kb and ko
View byte_converter.py
def get_printable_size(byte_size):
"""
A bit is the smallest unit, it's either 0 or 1
1 byte = 1 octet = 8 bits
1 kB = 1 kilobyte = 1000 bytes = 10^3 bytes
1 KiB = 1 kibibyte = 1024 bytes = 2^10 bytes
1 KB = 1 kibibyte OR kilobyte ~= 1024 bytes ~= 2^10 bytes (it usually means 1024 bytes but sometimes it's 1000... ask the sysadmin ;) )
1 kb = 1 kilobits = 1000 bits (this notation should not be used, as it is very confusing)
1 ko = 1 kilooctet = 1000 octets = 1000 bytes = 1 kB
@Diicorp95
Diicorp95 / camera_filenames.txt.js
Last active Jul 19, 2022 — forked from tonio-m/camera_filenames.txt
Camera naming conventions for video files. Try searching youtube for something like GOPR1234
View camera_filenames.txt.js
// Variables format and RegEx
`MOV${datetime_stamp}.${extension}`
`IMG${datetime_stamp}.${extension}`
`DSC${datetime_stamp}.${extension}`
`AMBA${datetime_stamp}.${extension}`
`SAM${datetime_stamp}.${extension}`
`GH01${datetime_stamp}.${extension}`
`GOPR${datetime_stamp}.${extension}`
`3D_L${datetime_stamp}.${extension}`
@Diicorp95
Diicorp95 / McGainer Experiment (bytebeat).js
Created Jul 19, 2022
"McGainer Experiment". Bytebeat, 8000 Hz. No copyright. UNLICENSE license.
View McGainer Experiment (bytebeat).js
/*
"McGainer Experiment". Bytebeat, 8000 Hz.
No copyright. UNLICENSE license.
*/
t/=(5.5-.2)/5.5,
//64-(2*(-t%128|t%833)|127)
//2*(-t%128|t%833)
2*(t%128|~t%833)|-t<<4%130|t*1.05
@Diicorp95
Diicorp95 / Bitcrush Microchip (bytebeat modifier).js
Created Jul 19, 2022
Bytebeat modifier: Bitcrush Microchip. Default: 8000 Hz. No copyright. UNLICENSE license.
View Bitcrush Microchip (bytebeat modifier).js
/*
Bytebeat modifier: Bitcrush Microchip
Default: 8000 Hz
No copyright. UNLICENSE license.
*/
t=(2**8*6.2&t*1.5*2**5/2)|t,
t+=
@Diicorp95
Diicorp95 / Tweet-Zag Box (bytebeat).js
Created Jul 19, 2022
Tweet-Zag Box. Bytebeat, 44100 Hz. No copyright. UNLICENSE license.
View Tweet-Zag Box (bytebeat).js
/*
Tweet-Zag Box. Bytebeat, 44100 Hz. No copyright. UNLICENSE license.
"It speeds up with time!
It changes with time!
There will be the end of the composition, approximately at t = 759250480!"
*/
t/=0.99999999923473-(1/(t+2**6)),((64*random(t))*(1-(1&t>>11))+(t*t*(1&t>>7)&64))/1.5
@Diicorp95
Diicorp95 / Bass Driver (bytebeat).js
Created Jul 19, 2022
Bass Driver. Bytebeat, 44100 Hz. No copyright. UNLICENSE license.
View Bass Driver (bytebeat).js
/*
Bass Driver. Bytebeat, 44100 Hz. No copyright. UNLICENSE license.
*/
t*=16000/44100, // remove this when sampling rate is 16000 Hz
t %= 2 ** 19, // remove this if you want
t & (t * (16000000 / (1 | t))) | ((~t>>3)^t) | (127 & t >> 6)
@Diicorp95
Diicorp95 / Glass-Bent synthesizer v1.js
Created Jul 19, 2022
Bytebeat: Glass-Bent synthesizer v1. JS code. UNLICENSE license.
View Glass-Bent synthesizer v1.js
/* Glass-Bent synthesizer v1. JS code. UNLICENSE license.
Bytebeat, 44100 Hz */
a = 6-(3&t>>13),
b = 14-(7&t>>11),
step_1 = 2,
step_2 = 2.03,
resonance_1 = 15,
resonance_2 = resonance_1 / 2,
accuracy = 3,
@Diicorp95
Diicorp95 / memories generator (bytebeat).js
Created Jul 19, 2022
MEMORIES... 😔 generator. Bytebeat or Signed Bytebeat. 💡 Sit back and listen. Meditate to the music. Copyleft 2022, Diicorp95. Licensed under UNLICENSE license.
View memories generator (bytebeat).js
/*
MEMORIES... 😔 generator. Bytebeat or Signed Bytebeat.
💡 Sit back and listen. Meditate to the music.
Copyleft 2022, Diicorp95. Licensed under UNLICENSE license.
*/
adapt_sample_rate = function(older, newer) {
t /= newer / older; // or t *= older / newer;
@Diicorp95
Diicorp95 / [Python 3] Precise integer base conversion.py
Created May 23, 2022
A script that precisely converts decimal integers to integers with other bases. UNLICENSE license.
View [Python 3] Precise integer base conversion.py
#!/usr/bin/python3
'''
"Precise integer base conversion"
UNLICENSE license.
'''
# - StackOverflow begin -
def convert_base(num, to_base=10, from_base=10, only_alphabet = False): # added
alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"