Skip to content

Instantly share code, notes, and snippets.

View CharlyJazz's full-sized avatar
🧭
I may be slow to respond.

Carlos Azuaje CharlyJazz

🧭
I may be slow to respond.
View GitHub Profile
@CharlyJazz
CharlyJazz / fibonacci-midi.py
Created October 29, 2016 01:23
Python - Generator that creates the fibonacci sequence and then becomes dodecafonism song
from __future__ import division
from itertools import chain
from pyknon.genmidi import Midi
from pyknon.music import Note, NoteSeq
def fib(n):
a, b = 0, 1
fibo = [a, b]
while b < n:
@CharlyJazz
CharlyJazz / write_letter_z.c
Last active November 12, 2016 14:35
Simple algorithm for create Z letter.
#include "stdio.h"
void Zeta(int foo);
int i = 0, j = 0, c = 0;
int main(void) {
// Disable stdout buffering
setvbuf(stdout, NULL, _IONBF, 0);
@CharlyJazz
CharlyJazz / duplicate_in_list.py
Last active November 28, 2016 21:21
If there are duplicates in a list return false
def distint(*args):
copy = args
for i in args:
f = 0
for j in copy:
if i is j and f is 0:
f += 1
elif i is j and f is 1:
return False
return True
@CharlyJazz
CharlyJazz / bennyandshopping.js
Created January 4, 2017 23:42
Hackereacth - Benny And Shopping Solution in Javascript
var first = '4';
var two = 'I want to buy Microsoft for $10000';
var three = 'this house costs $0 5 0 00 0 Just buy it';
var four = '$ 1 2 3 4 5 6 7 8 9 hello123';
var five = 'the cost is zero $ 0 0 0 0 0 0';
function main(input) {
//Enter your code here
var dollar = '$';
output = input.replace(/\D/g,'');
@CharlyJazz
CharlyJazz / chice_html.py
Last active April 1, 2017 13:04
Choice field for html created with pycountry v.1.5
class Country_list(list):
"""'create choice for html form"""
def __init__(self):
self.lista_alpha = []
self.lista_name = []
self.choice = None
def create_choices(self):
t = list(pycountry.countries)
for country in t:
@CharlyJazz
CharlyJazz / XMLHttpRequest.js
Last active May 17, 2023 08:13
XMLHttpRequest injection load javascript script.
//Before </body> tag
<script>
var xhr = new XMLHttpRequest();
xhr.open("get", "cookbook.js", true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status >= 200 && xhr.status < 300 || xhr.status == 304) {
var script = document.createElement("script");
script.type = "text/javascript";
script.text = xhr.responseText;
from urllib2 import urlopen
from BeautifulSoup import BeautifulSoup
url_target = 'https://es.wikipedia.org/wiki/Web_scraping'
class_target = 'mw-parser-output'
print BeautifulSoup(urlopen(url_target)).find("div", { "class" : class_target }).find("p").prettify()
@CharlyJazz
CharlyJazz / country_ip.py
Created July 7, 2017 17:29
Get country via IP
import pycountry
from geoip import geolite2
#I need test this code
def get_country(request_ip):
math = geolite2.lookup(request_ip) if geolite2.lookup(request_ip) is not None else geolite2.lookup_mine()
this_alpha = math.country
tz = str(math.timezone)
citycapital = tz[tz.index('/')+1:]
@CharlyJazz
CharlyJazz / index.html
Last active November 27, 2017 20:42
Suck filter div for class
<style>
.block__book_pagination__wrapper {
margin-top: 1em;
margin-bottom: 1em;
}
.block__book_pagination__wrapper > div.row {
margin-top: 2em;
margin-bottom: 2em;
}