Skip to content

Instantly share code, notes, and snippets.

Arian K. (ariankordi) ariankordi

Block or report user

Report or block ariankordi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View cheapvps-comparison.php
<?php
//ini_set('display_errors', 1);
$db = new SQLite3('cheapvps-comparison.db');
/*
CREATE TABLE "offers" (
"created_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"url" text NOT NULL,
"post_type" integer NOT NULL,
@ariankordi
ariankordi / sh-cgi-term.cgi
Last active Feb 6, 2019
A super simple command line in shell CGI, this is useful for executing commands on a cPanel/Apache shared hosting account LOL
View sh-cgi-term.cgi
#!/bin/sh
if [ $REQUEST_METHOD = "POST" ]; then
echo
$(cat) 2>&1
exit
fi
printf "Content-type: text/html\n\n"
#echo
View closedpizza-authorization.rb
# closedpizza-authorization.rb - mruby handler to check if all clients
# have accounts on closed.pizza, checked via ip address and result kept with lrucache
# there is also a redis class in h2o mruby but it probably isn't worth using
# to change returned status code/response for unauthorized users, see end of call method
# paths:
# /:
# mruby.handler-file: /path/to/closedpizza-authorization.rb
@ariankordi
ariankordi / realtime-chat-noextlibs.php
Last active Feb 15, 2019
A REAL-TIME (no AJAX polling), database-less, no-setup chat room in PHP, using SSE and shmop
View realtime-chat-noextlibs.php
<?php
// This chat thing uses nothing but shmop, but it requires SSE (Server-Sent Events) to work on your server.
// If this chat just does nothing, i.e. you post a message and literally nothing else happens, SSE probably doesn't work.
// Note that this file continuously reads a shared memory block and detects a difference, in order to get live messages.
// This might not be all that efficient, and can be intensive on your server. Don't leave this up for a long period of time.
// This will also not work with PHP's built-in server, due to it being single-threaded. Oh yeah, since this uses SSE, this will use a separate thread for every client that is connected.
// Have fun. This should work right away with no config.
// set the size of these shared memory blocks, "message buffers" here
@ariankordi
ariankordi / unix socket reverse proxy thing.php
Last active Feb 1, 2019
Reverse proxy to a UNIX socket with PHP, for when you are running Go web apps on cPanel servers or something like that LOL (complete with header and multipart POST form parsing!) Doesn't work with WebSocket though.
View unix socket reverse proxy thing.php
<?php
// This works best on Apache, and if you have enable_post_data_reading off.
// Set "php_flag enable_post_data_reading off" in your htaccess. It'll avoid having to parse multipart forms.
// enter the sock to connect to here
const SOCK_TO_CONNECT_TO = './run.sock';
// Close the session right now, because it might make everything faster, and we don't know how long the response will last for.
session_write_close();
View crunchyroll-lmao.sh
#!/bin/sh
# This script scrapes Crunchyroll to get an m3u8 and caption file.
# It then uses ffmpeg to download + mux it all into a single mp4.
# It uses awk for EVERYTHING. Sorry? I really wanted to use Python or something
# but that would make it into just a Python thing, or Node or whatever.
# This was painful though because I hate awk.
# See if argv has enough params
if [ $# -lt 2 ]; then
@ariankordi
ariankordi / librespot-download.go
Last active Nov 19, 2018
downloads track(s) (plural) from spotify (premium) with librespot LO LOLOLOLOLLO OLOLOLLOLLOLOOLLOLOOLOLOLOOLOLOLOLOLO
View librespot-download.go
package main
// AS OF this being posted, librespot-golang has some deadlocking and you will need to use this fork: https://github.com/benpye/librespot-golang
import (
"Spotify"
"librespot"
"librespot/core"
"librespot/utils"
@ariankordi
ariankordi / arman.py
Last active Nov 19, 2018
A script that just creates a post to indigo.cafe, and requires a login token
View arman.py
#!/bin/python3
# requirements: hyper selectolax
from sys import exit
from ssl import CERT_NONE
try:
import hyper
@ariankordi
ariankordi / adsense.go
Last active Sep 10, 2018
A little Go script that gets the AdSense revenue you have this month
View adsense.go
package main
import (
"github.com/valyala/fasthttp"
"bytes"
"fmt"
)
@ariankordi
ariankordi / closedverse-deadness.go
Last active Sep 10, 2018
A Go script that extracts the "x minutes ago", "x hours ago", etc text from Miiverse clones like https://cedar.doctor/titles/1, then averages them out and sees the average seconds between each post. Might be broken if these sites are down or IPs are just dead.
View closedverse-deadness.go
package main
import (
// requests
"github.com/valyala/fasthttp"
// for spltting bytes
"bytes"
// for getting the things from the thing
"regexp"
You can’t perform that action at this time.