Skip to content

Instantly share code, notes, and snippets.

View syndbg's full-sized avatar
🏠
Work From Home since 2020

Anton Antonov syndbg

🏠
Work From Home since 2020
View GitHub Profile
@syndbg
syndbg / glossary.md
Last active August 29, 2015 14:07
Function/method glossary

Сигнатура/хедър (header) на функция/метод

Дефинира фунцията, името й и параметрите, които приема. (за динамични езици - Python, Ruby, JS)

Пример:

def print(string)
@syndbg
syndbg / cat.py
Last active August 29, 2015 14:07
from sys import argv
def cat(filename):
file_contents = ''
try:
with open(filename, 'r') as f:
file_contents = f.read()
except FileNotFoundError:
return 'File {} not found.'.format(filename)
@syndbg
syndbg / kill-java-processes.py
Created July 23, 2014 14:52
Python script that runs **jps** and kills non-jps and eclipse processes. Useful for when your JVM gets fat with processes
import subprocess
def main():
jps_processes = subprocess.check_output(["jps"]).split("\n")
for line in jps_processes:
if not "jps" in line.lower() and not "eclipse" in line.lower():
line = line.split()
try:
process_id = line[0]
@syndbg
syndbg / fetch.py
Created July 14, 2014 00:14
A small Python script, that fetches a YouTube playlist's videos titles and writes them to a file playlist.txt in the same directory. Usage? A legal backup against video deletion. You could always find the song if you know the song title before it got removed
import gdata.youtube
import gdata.youtube.service
# Dependencies:
# - Python==2.7
# - gdata==2.0.18
# - google-api-python-client==1.2
@syndbg
syndbg / evil.py
Last active July 27, 2020 02:32
Just a super simple spam bot for educational purposes. If you're using *nix, you should pip install selenium.If you're using Windows, you don't deserve to use this anyway. (joke!) Dependencies: Python 2.7 - 3.4, selenium, chromewebdriver (Note: It'll download, extract and make it executable if you don't have it)
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
from subprocess import call
from os.path import exists
from urllib.request import urlretrieve
from os import remove
from subprocess import call