Skip to content

Instantly share code, notes, and snippets.

View ArtBIT's full-sized avatar
🤖
Explore, Experiment, Evolve

ArtBIT ArtBIT

🤖
Explore, Experiment, Evolve
View GitHub Profile
@ArtBIT
ArtBIT / thou shall not pusg merge commits.txt
Last active August 6, 2022 16:41
PUSH REJECTED BY EVIL DRAGON BUREAUCRATS
+---------------------------------------------------------------+
| * * * PUSH REJECTED BY EVIL DRAGON BUREAUCRATS * * * |
+---------------------------------------------------------------+
\
\ ^ /^
\ / \ // \
\ |\___/| / \// .\
\ /V V \__ / // | \ \ *----*
/ / \/_/ // | \ \ \ |
@___@` \/_ // | \ \ \/\ \
@ArtBIT
ArtBIT / kako_ime_zvuči_uz_prezime
Created November 24, 2017 12:59
Poslušaj kako zvuči ime uz prezime, koristeći program `espeak`
#!/bin/bash
# Primer:
# bash kako_ime_zvuči_uz_prezime Kovačević
# ...Momčilo, Momčilo Kovačević
# ...Višeslav, Višeslav Kovačević
PREZIME=$1
for IME in $(cat muška.imena.txt); do
espeak -m -v sr "<prosody rate='0.7'>$IME</prosody><break time='1000' /><prosody rate='1'>$IME $PREZIME</prosody><break time='1000' />"
@ArtBIT
ArtBIT / pingpong
Last active October 13, 2023 22:06
Keep TPLink Powerline alive by pinging it constantly
#!/bin/bash
GATEWAY=`route get default | grep gateway | awk '{ print }'`
SCRIPT_COMMAND="ping $GATEWAY"
SCRIPT_PID=/tmp/pingpong.pid
case "$1" in
start)
$SCRIPT_COMMAND 1>/dev/null &
echo $!>$SCRIPT_PID
@ArtBIT
ArtBIT / htmlTableToExcel.js
Last active March 24, 2017 10:04
Function to convert a HTML table to Excel, and to trigger download
var htmlTableToExcel = (function () {
var uri = 'data:application/vnd.ms-excel;base64,'
, template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'
, base64 = function(s) {return btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g, function(match, p1) {
return String.fromCharCode('0x' + p1);
}));
, format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }); };
return function (table, name, filename) {
if (!table.nodeType) table = document.getElementById(table);
var ctx = { worksheet: name || 'Worksheet', table: table.innerHTML };

Keybase proof

I hereby claim:

  • I am artbit on github.
  • I am ungar (https://keybase.io/ungar) on keybase.
  • I have a public key ASAFDd_kTCsD1bEPMvnsBDYWdNvQHndaXmB--pXlF7eJmAo

To claim this, I am signing this object:

@ArtBIT
ArtBIT / HAL900 Audio Record
Last active June 17, 2016 13:09
Record sounds from the HAL9000 microphone ans save them to /home/pi/recordings
#!/bin/bash
FILE=/tmp/mic.wav
arecord \
-D plughw:0 \
-f cd \
> $FILE
TARGET_DIR="${HOME}/recordings"
@ArtBIT
ArtBIT / HAL9000 Webcam
Last active June 5, 2016 21:17
WebCam capture script for HAL9000 and save them to /home/
#!/bin/bash
# Check out https://www.raspberrypi.org/documentation/usage/webcams/ for more info
# on using webcams and installing necessary software on your raspberry PI.
IMAGE=/tmp/webcam.jpg
fswebcam \
-d /dev/video0 \
-p YUYV \
@ArtBIT
ArtBIT / historymanipulation.mkd
Created January 15, 2016 18:27
Bash History Video Tutorial Transcription
  1. Overview of BASH history

    • history
  2. Basic History Recall

    • !! - Previous command
    • !n - Nth previous command
  3. Parameter Recall

    • !* - All parameters from the last command, excluding 0th (the command itself)
    • !:n - Nth parameter from the previous command (index starting from 1)
@ArtBIT
ArtBIT / robot.js
Created December 3, 2012 19:19
CRUSHER
var MAX_SPEED = 100;
var DISTANCE = 50;
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
this.dir = 1;
this.cannonDir = 1;
this.speed = MAX_SPEED*.8;
this.ts = 0;
this.pivot = {
@ArtBIT
ArtBIT / robot.js
Created December 3, 2012 17:10
DOOM II
var MAX_SPEED = 100;
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
this.pivot = {x:robot.arenaWidth/2, y:robot.arenaHeight/2, d:0};
this.dir = 1;
this.speed = MAX_SPEED*.8;
};
Robot.prototype.onIdle = function(ev) {