Skip to content

Instantly share code, notes, and snippets.

View sixem's full-sized avatar

emy sixem

  • ザ・ファイブ・コーポレーション
  • 20:33 (UTC +02:00)
View GitHub Profile
@sixem
sixem / ytdl
Last active April 9, 2019 01:25
#!/bin/bash
for var in "$@"
do
youtube-dl "$var" -o "[%(uploader)s] %(title)s [%(upload_date)s - %(id)s].%(ext)s" -f bestvideo+bestaudio
done
@sixem
sixem / twitch-name-checker.py
Last active April 26, 2019 03:52
Checks whether or not twitch usernames are available.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Usage: python twitch-name-checker.py list.txt
import requests
import sys
def main():
available_usernames = []
@sixem
sixem / temp.sh
Created April 17, 2019 11:45
temp.sh (TEMPered)
#!/bin/bash
OUTLINE=`/home/pi/TEMPered/build/utils/hid-query /dev/hidraw1 0x01 0x80 0x33 0x01 0x00 0x00 0x00 0x00|grep -A1 ^Response|tail -1`
OUTNUM=`echo $OUTLINE|sed -e 's/^[^0-9a-f]*[0-9a-f][0-9a-f] [0-9a-f][0-9a-f] \([0-9a-f][0-9a-f]\) \([0-9a-f][0-9a-f]\) .*$/0x\1\2/'`
HEX4=${OUTNUM:2:4}
DVAL=$(( 16#$HEX4 ))
CTEMP=$(bc <<< "scale=2; $DVAL/100")
FTEMP=$(echo "scale=2;((9/5) * $CTEMP) + 32" |bc)
echo "$CTEMP"
@sixem
sixem / tcp.py
Created May 3, 2019 02:02
Python TCP Class Example
import datetime
import socket
class TCP(object):
def __init__(self):
self.TCPClient = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def closeTCPConnection(self):
self.TCPClient.close()
// ==UserScript==
// @name Darker local text browsing
// @version 0.1
// @description Darkens the local .txt file page
// @match file:///*.txt
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle(`
body
@sixem
sixem / getYoutubeID.js
Last active September 19, 2019 03:33
Finds the Youtube ID of an input string.
function getYoutubeID(input)
{
if (~input.indexOf('?v='))
{
var str = input.split('?v=')[1]; var id = '';
for (var i = 0; i < str.length; i++)
{
if(str.charAt(i).match(/[a-zA-Z0-9-_]/i)) { id += str.charAt(i); if(id.length == 11) { return id; } }
}
@sixem
sixem / formatSince.php
Created July 12, 2020 14:42
Formats seconds to an 'ago' string.
// Formats seconds to an 'ago' string.
// Example: formatSince(3720); returns '1 hour and 2 minutes ago'.
function formatSince($seconds)
{
if($seconds === 0) { return 'Now'; } else if($seconds < 0) { return false; }
$t = array(
'year' => 31556926,
'month' => 2629743,
@sixem
sixem / userscript.js
Last active June 26, 2021 17:14
Removes recommended channels from the sidebar (Twitch)
// ==UserScript==
// @name Removes Recommended Channels
// @namespace Violentmonkey Scripts
// @match https://www.twitch.tv/*
// @grant none
// @version 1.0
// @author -
// @description 26/6/2021, 1:22:39 AM
// ==/UserScript==
#!/bin/bash
# Clones the repos of a user and updates them if they already have been cloned.
mkdir -p "$1" && cd "$1"
TOKEN="YOUR_GITHUB_AUTH-TOKEN"
declare -a CLONE=()
declare -a PULL=()
@sixem
sixem / ytdl-subs.sh
Created June 25, 2021 15:22
Downloads a YouTube video with all the subtitles packed into a .mkv file
#!/bin/bash
# ======================================================================== #
# Downloads a YouTube video with all the subtitles packed into a .mkv file #
# ======================================================================== #
# Usage: ./ytdl-subs.sh "YOUTUBE_URL" "OUTPUT_NAME_WITHOUT_EXTENSION"
UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)