Skip to content

Instantly share code, notes, and snippets.

@iamajeesh
iamajeesh / allInOneBackuper.php
Created January 5, 2015 19:22
backup each database to each sql file using root password
<?php
?>
@iamajeesh
iamajeesh / addswap.sh
Created January 15, 2015 17:48
Add Swap Ubuntu 14.04 LTS - This adds 1GB swap
sudo swapon -s
free -m
fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s
echo "/swapfile none swap sw 0 0" >> /etc/fstab
@iamajeesh
iamajeesh / function.php
Created January 21, 2015 17:26
PHP function to provide Download with resume/speed/stream options
<?php
/* Function: download with resume/speed/stream options */
/*
Parametrs: downloadFile(File Location, File Name,
max speed, is streaming
If streaming - movies will show as movies, images as images
instead of download prompt
*/
@iamajeesh
iamajeesh / site.conf
Created January 27, 2015 14:24
simple virtual host name example
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName site.com
ServerAlias www.site.com
DocumentRoot /var/www/html/site.com
<Directory /var/www//html/site.com>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
@iamajeesh
iamajeesh / disable.sh
Created January 29, 2015 10:10
disable Ipv6 usage
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6

Introduction

  • This script lets you set up and use a temporary DigitalOcean droplet to download torrent files.
  • Once downloaded, they can be streamed down to your local machine.
  • This uses transmission-cli for the torrent client, and nginx to serve files.

Setup on Local Machine

  • This assumes that you have a DigitalOcean account and tugboat set up, as well as seedbox-setup.sh present in the current directory.
@iamajeesh
iamajeesh / dropAll.php
Created May 13, 2015 07:29
Drop All Tables in Database Uisng PHP
<?php
$mysqli = new mysqli("localhost", "user", "pass", "dbname");
$mysqli->query('SET foreign_key_checks = 0');
if ($result = $mysqli->query("SHOW TABLES"))
{
while($row = $result->fetch_array(MYSQLI_NUM))
{
$mysqli->query('DROP TABLE IF EXISTS '.$row[0]);
echo $row[0].",\n";
@iamajeesh
iamajeesh / stream_to_youtube.sh
Created January 6, 2016 04:59 — forked from olasd/stream_to_youtube.sh
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
@iamajeesh
iamajeesh / add_virtual_host.sh
Last active October 24, 2023 01:47
create a quick virtual host bash script
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <domain>"
exit 1
fi
domain="$1"
# Check if the virtual host file already exists