Skip to content

Instantly share code, notes, and snippets.

View LunaSquee's full-sized avatar

Evert Prants LunaSquee

View GitHub Profile
// The MIT License (MIT)
// Copyright (c) 2014-2016 Jack O'Connor
// https://github.com/jackocnr/intl-tel-input
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@LunaSquee
LunaSquee / screenshot.sh
Created May 17, 2018 18:24
Screenshot script
#!/bin/bash
# Depends: scrot, feh, gnome-screenshot, zenity, xclip
outputDir="~/Pictures"
output="Screenshot_`date +"%y-%m-%d-%T"`.png"
tmp=$(mktemp -u); scrot -e "mv \$f $tmp"; feh -F $tmp & gnome-screenshot -a -f $outputDir/$output && rm $tmp && pkill -P $$
# Rewritable upload command
@LunaSquee
LunaSquee / yt-trending.userscript.js
Last active December 6, 2017 21:09
YouTube Trending is trash
@LunaSquee
LunaSquee / queue.js
Last active February 16, 2023 01:52
Liquidsoap radio + youtube-dl queueing (Node.js as helper)
// $ node queue <file name or youtube URL>
const net = require('net')
let client = net.connect(1234, 'localhost')
client.on('connect', function () {
if (process.argv[2]) {
console.log('Queueing ' + process.argv[2])
client.write('queue.push smart:' + process.argv[2] + '\r\n')
}
@LunaSquee
LunaSquee / godot_utils.gd
Created February 24, 2017 18:56
Godot utilities
# UUID Generation
func generate_uuid():
var repls = "xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx"
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
for c in range(0, repls.length()-1):
if repls[c] == "x":
randomize()
var rander = rand_range(1, chars.length()) - 1
repls[c] = chars[floor(rander)]
@LunaSquee
LunaSquee / cli_progress_bar.js
Last active October 19, 2016 17:24
JavaScript CLI-style progress bar with variable width
/**
* Example:
* progress_bar(40, 0.5);
* Returns:
* [####################-------------------] 50%
*
*/
function progress_bar(barsize, percentage) {
let bar = "";
let cnt = Math.floor(barsize * percentage);
@LunaSquee
LunaSquee / icevents.js
Created October 3, 2016 13:08
Custom node.js event emitter class
class IcyEmitter {
constructor() {
this.listeners = {};
this.on = this.addEventListener;
}
emitAll(event) {
for(let a in this.listeners) {
let scopes = this.listeners[a];
for(let b in scopes) {
@LunaSquee
LunaSquee / thingy.html
Last active August 23, 2016 11:06
thingy - web shell (terminal emulator) [BASE APPLICATION]
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
body{
margin: 0;
padding: 0;
background-color: #04050a;
color: #fff;
font-size: 120%;
@LunaSquee
LunaSquee / icy_screenshot.sh
Last active December 4, 2015 21:48
icy_screenshot - imgur_screenshot-based image uploader (to my server)
#!/bin/bash
# Based on imgur-screenshot by jomo
# https://github.com/jomo/imgur-screenshot
#
# Uploads images to https://lunasquee.eu.org/upload/
# Deps: scrot, xclip, libnotify-bin (also grep and curl)
# Works only on linux-based systems
#
# $HOME/.config/icy-screenshot/settings.conf file can override options below
@LunaSquee
LunaSquee / ircconnection.js
Last active September 1, 2015 13:29
IRC utilities for node.js
var net = require('net')
var readline = require('readline');
var connected = false;
var socket = null;
var reconclock = null;
function spawn(ADDR, PORT, NICK) {
console.log("CREATE SOCK "+ADDR+":"+PORT);
socket = net.connect(PORT, ADDR, function() {