Skip to content

Instantly share code, notes, and snippets.

View Depado's full-sized avatar
😁
Coding and Writing Posts

Depado

😁
Coding and Writing Posts
View GitHub Profile
func webhook(c *gin.Context) {
var err error
var dfr *df.Request
if err = c.BindJSON(&dfr); err != nil {
c.AbortWithStatus(http.StatusBadRequest)
return
}
switch dfr.QueryResult.Action {
func webhook(c *gin.Context) {
var err error
var dfr *df.Request
if err = c.BindJSON(&dfr); err != nil {
c.AbortWithStatus(http.StatusBadRequest)
return
}
spew.Dump(dfr)
c.JSON(http.StatusOK, gin.H{})
func webhook(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{})
}
func main() {
r := gin.Default()
r.POST("/webhook", webhook)
if err := r.Run("127.0.0.1:8001"); err != nil {
panic(err)
}
@Depado
Depado / main.go
Created October 5, 2017 10:40
Integrating Chroma in Blackfriday
package main
import (
"fmt"
"io"
"github.com/alecthomas/chroma"
"github.com/alecthomas/chroma/formatters/html"
"github.com/alecthomas/chroma/lexers"

Keybase proof

I hereby claim:

  • I am depado on github.
  • I am depado (https://keybase.io/depado) on keybase.
  • I have a public key ASBe2qj0k7FFoS5w7WJAWGBj4bNnFQBjnhfq1zwmjvrvNgo

To claim this, I am signing this object:

@Depado
Depado / goploader.py
Last active June 16, 2016 05:19
Simple goploader usage with python and requests
import requests
url = "https://gpldr.in"
files = {'file': open('path/to/file', 'rb')}
# Sending a file with defaults configuration
r = requests.post(url, files=files)
print(r.text)
# Sending a file and specify it is visible only once
r = requests.post(url, files=files, data={"once":"true"})
Verifying that +depado is my blockchain ID. https://onename.com/depado
@Depado
Depado / aes_cipher.py
Created January 28, 2015 13:16
A Simple AES Cipher comptabiel with Python 3
class AESCipher(object):
"""
A classical AES Cipher. Can use any size of data and any size of password thanks to padding.
Also ensure the coherence and the type of the data with a unicode to byte converter.
"""
def __init__(self, key):
self.bs = 32
self.key = hashlib.sha256(AESCipher.str_to_bytes(key)).digest()
@staticmethod
@Depado
Depado / periodic.py
Last active May 1, 2024 16:08
Creating and executing a periodic task in Python with no additionnal module (without Celery)
# Only dependency needed
import threading
# Dependency for the task
import datetime
import time
# Function wrapper
def periodic_task(interval, times = -1):
def outer_wrap(function):
@Depado
Depado / game.py
Created August 19, 2013 12:58
Correction
import pygame
from pygame.locals import *
from tkinter import *
from constantes import *
# Déjà, pourquoi tu créé une fenêtre avec Tkinter alors que Pygame sait très bien le faire ?
# On crée une fenêtre, racine de notre interface
fenetre = Tk()
fenetre.title('Launcher Veneficus Legend 1.0 ')