Skip to content

Instantly share code, notes, and snippets.

View muhammedfurkan's full-sized avatar
🙃

M.Furkan muhammedfurkan

🙃
View GitHub Profile
#!/usr/bin/python
from time import strftime
import sqlite3
import sys
import twitter #http://code.google.com/p/python-twitter/
import feedparser #available at feedparser.org
DATABASE = "/Users/goerz/.twitter_bot/tweets.sqlite"
import os
import zipfile
cur_path = os.getcwd()
filenames = [file for file in os.listdir(cur_path) if file[-3:] == 'zip']
print(filenames)
for archive in filenames:
myzip = zipfile.ZipFile(archive)
@kenelliott-gists
kenelliott-gists / removesite.sh
Created September 11, 2012 01:18
Shell: remove nginx virtual host
#!/bin/bash
# script location
available=/etc/nginx/sites-available
enabled=/etc/nginx/sites-enabled
sites=/media/psf/Home/Sites
www=/var/www
if [ ! $1 ] ; then
echo "no parameter provided"
@consti
consti / hosts
Last active March 20, 2025 21:29
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost
@runbrun
runbrun / addvhost.sh
Created January 18, 2014 00:09
bash script to create nginx virtual hosts
#!/usr/bin/env bash
#
# Nginx - new server block
# http://rosehosting.com
read -p "Enter username : " username
read -p "Enter domain name : " domain
# Functions
ok() { echo -e '\e[32m'$domain'\e[m'; } # Green
die() { echo -e '\e[1;31m'$domain'\e[m'; exit 1; }
@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active March 28, 2025 11:24
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
@valdergallo
valdergallo / download_file.py
Created April 23, 2014 21:06
Download and unzip file
def download(url, save_to_diretory='.'):
def percent(downloaded, total_size):
return (math.floor((downloaded / total_size) * 100))
# Open the url
try:
req = urlopen(url)
#handle errors
except HTTPError, e:
print "HTTP Error:", e.code, url
@mpaddock
mpaddock / nginx-conf.sh
Created November 7, 2014 18:13
nginx conf file generation
WEB_DIR='/var/meteor'
DIRS=`ls -l --time-style="long-iso" $WEB_DIR | egrep '^d' | awk '{print 8}'`
PORT=3000
NGINX_CONF='/etc/nginx/sites-available/meteordev.conf'
touch $NGINX_CONF
cat << EOF > $NGINX_CONF
server {
listen 80;
server_name meteordev.as.uky.edu;
@t0mll
t0mll / wpinstall.sh
Last active November 10, 2024 22:39
#!/bin/bash -e
clear
echo "============================================"
echo "Nginx configuration files"
echo "============================================"
# Check if the global directory exists
DIRECTORY="/etc/nginx/global"
if [ ! -d "$DIRECTORY" ]; then
# Create the directory
import pafy
playlist_url = raw_input("Please enter a proper Youtube playlist URL: ") #must be properly formatted like https://www.youtube.com/playlist?list=PL557BC4AF6ABFF637
playlist = pafy.get_playlist(playlist_url)
how_many_vids_in_this_playlist = len(playlist['items']) #long variables are fun
print "Thanks for the URL, I'm now going to download", how_many_vids_in_this_playlist, "videos"
for videos in playlist['items']: