Skip to content

Instantly share code, notes, and snippets.

View ihfazhillah's full-sized avatar

IbnuAmin ihfazhillah

View GitHub Profile
const validator = require("email-validator");
module.exports = function(context, callback) {
/*
* module to check email, context.data.input is a scaphold's CreateUserInput.
* email is must be valid email, using email-validator
*/
const userInput = context.data.input;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ihfazhillah
ihfazhillah / feedparser.py
Created May 26, 2018 15:25
example of feedparser use
import feedparser
url = "your rss url"
parsed = feedparser.parse(url)
for item in parsed.entries:
print("title " + item.title)
print("description " + item.description)
print("guid " + item.guid)
@ihfazhillah
ihfazhillah / models.py
Last active May 26, 2018 15:47
models for feedparser
# actually, i create it in one file :D
import mongoengine
mongoengine.connect("upwork", host="the host url that you got from mlab.com")
class Url(mongoengine.Document):
title = mongoengine.StringField()
url = mongoengine.StringField()
@ihfazhillah
ihfazhillah / iterate.py
Created May 26, 2018 15:57
iterating over all urls from Url objects.
"""
1. iterate over all urls
2. parse
3. if item not in database: create notification and save
4. else: pass
"""
for url in Url.objects:
parsed = feedparser.parse(url.url) # note that we need the url attribute not Url object in order to parsing rss
@ihfazhillah
ihfazhillah / telethon.py
Created May 26, 2018 16:13
intro with telethon
import telethon
# lets play first with telethon
# create client
app_id = ''
app_hash = '' # you got this two from my.telegram.org
client = telethon.TelegramClient('session-name', app_id, app_hash)
client.start()
#!/bin/bash
# pip install uncompyle6
for item in $(tree --noreport -if -P '*.pyc'); do
if [[ -f $item ]]; then
folder=$(dirname $item)
uncompyle6 -o $folder $item
#statements
fi
@ihfazhillah
ihfazhillah / index.html
Created May 22, 2019 06:28
google recaptcha
// 1
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
// 2
<script src="https://www.google.com/recaptcha/api.js?render=reCAPTCHA_site_key"></script>
<script>
// 3
grecaptcha.ready(function() {
// 4
// 1
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
// 2
<script src="https://www.google.com/recaptcha/api.js?render=reCAPTCHA_site_key"></script>
<script>
// 3
grecaptcha.ready(function() {
// 4
RECAPTCHA_SITE_KEY = "your site key"
RECAPTCHA_SECRET_KEY = "your secret key"