Skip to content

Instantly share code, notes, and snippets.

@mksglu
mksglu / sozcu.disable-popup.js
Created May 31, 2020 10:49
Sözcü'de bazen okumak istediğim bir haber olduğunda ısrarla karşıma çıkan popup'un ağzını yüzünü kıran bir kod parçası.
var p=Array.prototype.slice.call(document.querySelectorAll(".fc-ab-root"));p.forEach(function(o){o.parentNode.removeChild(o)}),document.body.style.overflow="auto";
anonymous
anonymous / soldier.py
Created August 25, 2015 10:40
class Soldier(object):
TYPE_MAP = {
'kurdish': 'PKK Member',
'alawite': 'DHPKC Member',
'socialist': 'Traitor',
'critic': 'Parallel'
}
@classmethod
def get_type(cls, param):
# The install script
# Adapted from https://gist.github.com/579814
install_path=local
download_path=Downloads/node-latest-install
echo '# Added by install script for node.js and npm in 30s' >> ~/.bashrc
echo 'export PATH=$HOME/'$install_path'/bin:$PATH' >> ~/.bashrc
echo 'export NODE_PATH=$HOME/'$install_path'/lib/node_modules' >> ~/.bashrc
. ~/.bashrc
@emre
emre / video_url_to_video_code.py
Created July 5, 2012 22:48
video URL to video code converter for popular video sharing sites.
import re
def videoUrlToVideoCode(url):
if not url.startswith("http://"):
raise ValueError(u'URL http:// ile başlamalıdır.')
pattern_list = [
['youtube.com', 'youtube\.com/watch\?v=([^&]*)'],
['vimeo.com', 'vimeo.com\/([0-9]*)$'],
@dwayne
dwayne / 00-install-on-64-bit-ubuntu-14.04.md
Last active January 12, 2024 17:48
Installing node and npm on Ubuntu 12.04 LTS and 64-bit Ubuntu 14.04 LTS.
  1. Navigate to http://nodejs.org/download/ and on the Linux Binaries (.tar.gz) row click to download the 64-bit version of the current latest release.

  2. Say you've downloaded node-v0.10.7-linux-x64.tar.gz into the Downloads directory. Then, open the terminal and type the following:

$ cd ~/Downloads
$ mkdir -p ~/local/node
$ tar xzf node-v0.10.7-linux-x64.tar.gz -C ~/local/node --strip-components=1
$ echo '# Node Enviroment Setup' >> ~/.bashrc
$ echo 'export PATH=$HOME/local/node/bin:$PATH' >> ~/.bashrc
@huseyinyilmaz
huseyinyilmaz / imagewiththumbnails.py
Created July 22, 2011 07:11
A django thumbnail support example
class ImageWithThumbnail(models.Model):
name = models.CharField(max_length = 255)
image = models.ImageField(upload_to=settings.UPLOAD_ROOT,max_length=500,blank=True,null=True)
thumbnail = models.ImageField(upload_to=settings.UPLOAD_ROOT,max_length=500,blank=True,null=True)
def create_thumbnail(self):
# original code for this method came from
# http://snipt.net/danfreak/generate-thumbnails-in-django-with-pil/
@melissaboiko
melissaboiko / nostalgic.py
Created July 13, 2011 13:45
simple matrix-style demo. done out of nostalgia for what it was like to study linux in the 90s.
#!/usr/bin/env python
import locale
import curses as c
from curses.wrapper import wrapper
import random
locale.setlocale(locale.LC_ALL,'')
coding = locale.getpreferredencoding()
random.seed()
# more = use digits more often
@miratcan
miratcan / komikaze.py
Created June 30, 2011 18:34
a Crawler for komikaze.net
"""
Mirat Can Bayrak / 2009
"""
from urllib import urlopen, urlretrieve
from datetime import date as Date
from datetime import timedelta
from xml.dom import minidom
from os.path import basename
import re
@miratcan
miratcan / pivotal2github.py
Created June 29, 2011 16:47
Simple script for migrating from pivotaltracker to github
from github2.client import Github
from csv import reader as CsvReader
# FILL INFORMATION BELOW
# your username at github
GITHUB_USERNAME = ""
# your api token, you can find it at https://github.com/account/admin
GITHUB_API_TOKEN = ""
@miratcan
miratcan / cups.py
Created June 8, 2011 21:53 — forked from huseyinyilmaz/cups.py
my solution for 40 cups and 9 oranges problem.
#!/usr/bin/python3.2
from itertools import combinations
"""
You have 40 bowls, all placed in a line at exact intervals of 1 meter. You also have 9 oranges. You wish to place all the oranges in the bowls, no more than one orange in each bowl, so that there are no three oranges A, B, and C such that the distance between A and B is equal to the distance between B and C. How many ways can you arrange the oranges in the bowls?.
(http://www.bittorrent.com/company/about/developer_challenge)
"""
def find_count(orange_count=9,cup_count=40,start_point=0,l=[]):
"""
orange_count: how many oranges should be placed in cups. for our question it is 9.
cup_count: how many cups should be used