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));
@spicydog
spicydog / No-IP Update with PHP and Crontab
Last active February 17, 2020 12:34
PHP Script for updating ip for no-ip DDNS and example script for crontab
# Update no-ip ip every one hour
0 * * * * curl "YOUR_HOST_URL/noip-updater.php" > /dev/null 2>&1
<?php
chdir(__DIR__);
define('LAST_FILE', 'last_manga.json');
define('MANGA_DIR', 'manga');
$names = [];
$names[] = 'terra-formars';
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;
<?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]];
package main
import "encoding/json"
// Unescape UTF-8 string
// e.g. convert "\u0e27\u0e23\u0e0d\u0e32" to "วรญา"
func UnescapeString(str string) (unescapedString string) {
json.Unmarshal([]byte(`"`+str+`"`), &unescapedString)
return
}
@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 / dockerfile
Created September 24, 2016 14:58
docker ubuntu nginx php7.0 mariadb
FROM ubuntu:latest
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get install -y vim curl wget
RUN apt-get install -y software-properties-common language-pack-en-base
RUN LC_ALL=en_US.UTF-8 add-apt-repository -y ppa:ondrej/php
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
RUN add-apt-repository -y 'deb [arch=amd64,i386,ppc64el] http://mirrors.bestthaihost.com/mariadb/repo/10.1/ubuntu xenial main'
@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 ระบบคำนวณเกรดวิชาเรียน',