Skip to content

Instantly share code, notes, and snippets.

View malandro-sv's full-sized avatar

Alejandro malandro-sv

View GitHub Profile
# CodeCademy, Practice makes perfect.
def product(n):
total = 1
for x in n:
total *= x
return total
# Practice makes perfect, Purify.
def purify(series):
new_series = []
for x in series:
if x % 2 == 0:
new_series.append(x)
return new_series
# Codecademy, Practice makes perfect, 13:
# Will multiply all items in a list.
# Have to initialize total as 1
# total = 0 will not work for obvious reasons.
def product(n):
total = 1
for x in n:
total *= x
return total
# CodeCademy, Practice Makes Perfect.
def remove_duplicates(n):
b = []
for x in n:
if x not in b:
b.append(x)
return b
# Practice makes perfect, median.
# l1 = [8, 9, 10, 5, 6, 7, 1, 2, 3, 4]
def median(l):
l.sort()
print l
result = []
#odd numbers:
#for i in l:
if len(l) % 2 > 0:
@malandro-sv
malandro-sv / [Vundle] search
Created April 29, 2016 17:23
basic mpd file... have to decruftify it a bit
@malandro-sv
malandro-sv / config
Created April 29, 2016 17:25
Have to clean it a bit and include visualizations
##############################################################
## This is the example configuration file. Copy it to ##
## $HOME/.ncmpcpp/config or $XDG_CONFIG_HOME/ncmpcpp/config ##
## and set up your preferences. ##
##############################################################
#
##### directories ######
##
## Directory for storing ncmpcpp related files.
## Changing it is useful if you want to store
@malandro-sv
malandro-sv / zip_extractor
Last active May 3, 2016 06:35
Simple zip file extractor for Python3.x
#!/usr/bin/python
# will extract a .zip file in the desired location.
# Nam Lah, May 2nd, 2016.
# Based on Tom O'connor's response in
# http://serverfault.com/questions/530114/are-there-other-options-to-unzip-a-file-in-ubuntu-besides-unzip
import zipfile
filename=input('Enter your .zip file name:\n>> ')
@malandro-sv
malandro-sv / japanesekid-captions.py
Last active August 13, 2018 04:56
Japanese Kid Meme scripter: pipipipipipi :v
# !/usr/bin/python3
# Nam Lah's text converter:
# Will take a string and stdout all vowels as 'i'.
# 2016, inspired on https://memegenerator.net/Japanese-Kid
# fak u faggitz.
def replacer(t):
new_t = ""
for char in t:
if char.lower() in 'aeou':
-- Standard awesome library
local gears = require("gears")
vicious = require("vicious")
local awful = require("awful")
awful.rules = require("awful.rules")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")