Skip to content

Instantly share code, notes, and snippets.

View spicydog's full-sized avatar

spicydog spicydog

View GitHub Profile
@spicydog
spicydog / anime_auto_download.php
Last active December 1, 2015 08:32
Auto anime download with aria2c and php from horriblesubs.info
<?php
$keyword = 'one piece';
$keyword = 'fairy tail';
function subBetweenStrings($string, $begin, $end) {
if($begin==='')
return substr( $string, 0, strpos($string,$end) );
if($end==='')
return substr($string, strpos($string, $begin)+strlen($begin));
<?php
chdir(__DIR__);
define('LAST_FILE', 'last_manga.json');
define('MANGA_DIR', 'manga');
$names = [];
$names[] = 'terra-formars';
<?php
$fullActions = ['U'=>'Up', 'L'=>'Left', 'R'=>'Right', 'D'=>'Down'];
$fullMoves = ['U'=>'^', 'L'=>'<', 'R'=>'>', 'D'=>'v'];
$rewards = [[-0.04,-0.04,-0.04],
[-0.04,-1,1],
[-0.04,-0.04,-0.04]];
@spicydog
spicydog / btsync.sh
Created July 10, 2016 10:52
Install btsync on Debian and Ubuntu
#!/bin/bash
apt-key adv --keyserver keys.gnupg.net --recv-keys 6BF18B15
CODENAME=$(lsb_release -cs | sed -n '/lucid\|precise\|quantal\|raring\|saucy\|trusty\|squeeze\|wheezy\|jessie\|sid/p')
echo "" >> /etc/apt/sources.list
echo "#### BitTorrent Sync - see: http://forum.bittorrent.com/topic/18974-debian-and-ubuntu-server-packages-for-bittorrent-sync-121-1/" >> /etc/apt/sources.list
echo "## Run this command: apt-key adv --keyserver keys.gnupg.net --recv-keys 6BF18B15" >> /etc/apt/sources.list
echo "deb http://debian.yeasoft.net/btsync ${CODENAME:-sid} main" >> /etc/apt/sources.list
echo "deb-src http://debian.yeasoft.net/btsync ${CODENAME:-sid} main" >> /etc/apt/sources.list
unset CODENAME
apt-get update
@spicydog
spicydog / speedtest.sh
Created July 10, 2016 16:07
Speedtest with wget
wget -O /dev/null [[URL]]
@spicydog
spicydog / random_project.php
Last active November 7, 2016 14:15
Random Project on Web Programming 2016
<?php
$projects = [
'1 ร้านเช่า หนังสือ',
'2 ร้านเช่า ชุดเสื้อผ้า เครื่องแต่งกาย',
'3 ร้านเช่า รถยนต์',
'4 ระบบสมัครสมาชิก',
'5 เว็บ Blog',
'6 ระบบจองคิวคลินิก',
'7 ระบบสั่งอาหารจากโต๊ะ',
'8 ระบบคำนวณเกรดวิชาเรียน',
@spicydog
spicydog / Authenticate.php
Last active November 14, 2016 03:38
Laravel Authentication Middleware
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class Authenticate
{
/**
@spicydog
spicydog / keybase.md
Created December 13, 2016 05:22
keybase.md

Keybase proof

I hereby claim:

  • I am spicydog on github.
  • I am spicydog (https://keybase.io/spicydog) on keybase.
  • I have a public key whose fingerprint is 7F92 B174 29D3 8BAE 25D5 A98B 6EFF 2366 9E52 EDC1

To claim this, I am signing this object:

@spicydog
spicydog / gist:99da4482692fcb4028d44a848d8801ea
Created December 15, 2016 06:56
NGINX Let's Encrypt custom webroot location
location ^~ /.well-known/acme-challenge/ {
alias /var/www/acme-challenge/;
}
import java.security.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.DataInputStream;
import java.io.ByteArrayInputStream;
import java.io.FileOutputStream;
import java.security.spec.*;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;