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
@grofit
grofit / traefik-compose.yml
Created May 23, 2020 19:32
Setting up Traefik 2 dashboard with basic auth, this is the same as my basic traefik 2 setup but with user auth from a file, you can see the original one here https://gist.github.com/grofit/e9a94ca02ba31ed1db9f88104f81c502
version: "3.7"
services:
traefik:
image: "traefik:v2.2"
container_name: "traefik"
ports:
- "80:80"
- "443:443"
- "8080:8080"
@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"
)
@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:
@jamesguan
jamesguan / python-date-format-to-javascript.js
Last active January 16, 2024 21:36
Function to convert python datetime format to javascript datetime format
// ES6 syntax is used.
/* Key: Python format
* Value: Javascript format
*/
const pyToJSDateFormats = Object.freeze({
'%A': 'dddd', //Weekday as locale’s full name: (In English: Sunday, .., Saturday)(Auf Deutsch: Sonntag, .., Samstag)
'%a': 'ddd', //Weekday abbreivated: (In English: Sun, .., Sat)(Auf Deutsch: So, .., Sa)
'%B': 'MMMM', //Month name: (In English: January, .., December)(Auf Deutsch: Januar, .., Dezember)
'%b': 'MMM', //Month name abbreviated: (In English: Jan, .., Dec)(Auf Deutsch: Jan, .., Dez)
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:
@deviantony
deviantony / README.md
Last active February 20, 2024 15:22
Portainer HTTP API by example

DEPRECATION NOTICE

This gist is now deprecated in favor of our official documentation: https://documentation.portainer.io/api/api-examples/ which contains up to date examples!

THE FOLLOWING DOCUMENTATION IS DEPRECATED

Please refer to the link above to get access to our updated API documentation and examples.

@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)
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@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)
@teknoraver
teknoraver / unixhttpc.go
Last active March 21, 2024 11:48
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"