Skip to content

Instantly share code, notes, and snippets.

View hamidfzm's full-sized avatar
🔥
Working from Hell

Hamid Feizabadi hamidfzm

🔥
Working from Hell
View GitHub Profile
@msukmanowsky
msukmanowsky / image_file_validator.py
Last active November 13, 2017 19:51
An ImageFieldRequired validator for a Flask WTForm.
from flask.ext.wtf import Form
from flask.ext.wtf.file import FileField
import imghdr
class ImageFileRequired(object):
"""
Validates that an uploaded file from a flask_wtf FileField is, in fact an
image. Better than checking the file extension, examines the header of
@dinukasal
dinukasal / .gitlab-ci.yml
Created February 4, 2018 14:28
Gitlab CI for react-native builds
image: openjdk:8-jdk
# image: jangrewe/gitlab-ci-android
variables:
ANDROID_COMPILE_SDK: "23"
ANDROID_BUILD_TOOLS: "23.0.1"
ANDROID_SDK_TOOLS: "3859397"
before_script:
@alexanderjulo
alexanderjulo / celery-crontab.py
Created June 29, 2012 15:16
celery crontab example
from celery.schedules import crontab
from flask.ext.celery import Celery
CELERYBEAT_SCHEDULE = {
# executes every night at 4:15
'every-night': {
'task': 'user.checkaccounts',
'schedule': crontab(hour=4, minute=20)
}
}
@5lx
5lx / udocf.sh
Created June 17, 2016 15:55
Update Digital Ocean Floating IP and Cloudflare DNS Record
#!/bin/bash
DO_TOKEN=
DO_API=https://api.digitalocean.com/v2
CF_API_KEY=
CF_AUTH_EMAIL=
CF_ROOT_DOMAIN=
CF_RECORD=
CF_API=https://api.cloudflare.com/client/v4
@ssomnoremac
ssomnoremac / schema_with_mutation.py
Created March 17, 2017 19:23
mutation example graphene sqlAlchemy
...
class UpdatePersonName(graphene.Mutation):
class Input:
uuid = graphene.Int(required=True)
name = graphene.String(required=True)
person = graphene.Field(Person)
When building an adnroid app, you might stumble upon this error:
`Failed to finalize session : INSTALL_FAILED_UPDATE_INCOMPATIBLE...`. Here's how to fix it:
That's because the app you're trying to test was already installed on the device and the signatures are different now, so it's complaining. The full error will look like something like this:
`Failed to finalize session : INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.example signatures do not match the previously installed version; ignoring!`
You can see that the package ID is `com.example`, well, simply run this command:
@sameerkumar18
sameerkumar18 / example_flask_googlecaptcha.py
Created May 20, 2017 07:04
A Simple Python Flask Example for Google Recaptcha (implemented on http://ipusearch.herokuapp.com)
RECAPTCHA_PUBLIC_KEY = '<public key>'
RECAPTCHA_PRIVATE_KEY = '<private key>'
def checkRecaptcha(response, secretkey):
url = 'https://www.google.com/recaptcha/api/siteverify?'
url = url + 'secret=' + str(secretkey)
url = url + '&response=' +str(response)
@nilsmagnus
nilsmagnus / sign_and_verify_test.go
Last active October 10, 2022 16:38
Sign a message and verify signature with go using PKCS1. Compatible with java (SHA256withRSA)
package main
import (
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"encoding/base64"
"testing"
)
@comp615
comp615 / leaflet_numbered_markers.css
Created April 2, 2012 23:51
Numbered Markers in Leaflet (JS Mapping)
.leaflet-div-icon {
background: transparent;
border: none;
}
.leaflet-marker-icon .number{
position: relative;
top: -37px;
font-size: 12px;
width: 25px;
@andelf
andelf / sendMail.go
Last active September 20, 2023 15:13
golang send mail net/smtp SMTP
package main
import (
"log"
"net/mail"
"encoding/base64"
"net/smtp"
"fmt"
"strings"