Skip to content

Instantly share code, notes, and snippets.

View Ge0's full-sized avatar

Geoffrey ROYER Ge0

View GitHub Profile
@omarryhan
omarryhan / Sanic-Gino-Alembic migrations Setup
Last active May 30, 2020 15:49
Sanic/Gino/Alembic migrations
# Do the first 6 steps only once.
1. pip install --user alembic
2. bash: ``cd {{my_project}} && alembic init alembic``
3. bash: ``text_editor {{my_project}}/alembic.ini``
4. Change: "sqlalchemy.url = postgres://{{username}}:{{password}}@{{address}}/{{db_name}}"
5. bash: ``text_editor {{my_project}}/alembic/env.py``
6. Now, import your metadata/db object from your app.:
# {{my_project}}/{{my_project_dir}}/app.py
@RohitSurwase
RohitSurwase / CoroutineIntentService.kt
Last active May 22, 2024 22:54
IntentService (Service) using Kotlin Coroutines instead of Handler+Looper.
import android.app.Service
import android.content.Intent
import android.os.IBinder
import android.support.annotation.Nullable
import android.support.annotation.WorkerThread
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.channels.actor
import kotlin.coroutines.CoroutineContext
@apprenticenaomi
apprenticenaomi / ion.py
Created July 13, 2017 07:24
Python DeDRM KFX v0.1
# BinaryIon.pas + DrmIon.pas + IonSymbols.pas
import collections
import enum
import hashlib
import hmac
import os
import os.path
import struct
"""[4] Migrate complex_uuid data to user table
Revision ID: dc33b414403d
Revises: 336cf482107d
Create Date: 2017-06-21 15:24:46.691582
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
@hiq-larryschiefer
hiq-larryschiefer / SampleService.java
Last active April 4, 2022 23:07
Example of an Android Service using a periodic Runnable on a simple background thread
/*
* Example code to help with Stack Overflow post:
* http://stackoverflow.com/questions/35843374/android-pausing-service-thread-asynctask-using-a-handler-with-postdelayed-for
*
* THIS IS JUST SAMPLE CODE, HAS NOT BEEN BUILT OR TESTED.
*/
public class MyService extends Service {
protected static final DEFAULT_TIMEOUT = 5000;
protected static final EXTENDED_TIMEOUT = 20000;
@maximilian-lindsey
maximilian-lindsey / express_in_electron.md
Last active March 29, 2024 22:46
How to run Express inside an Electron app

How to run Express inside an Electron app

You can run your Express app very easily inside your Electron app.

All you need to do is to:

  • place all the files of your Express app inside a new app folder in your_electron_app\resources\app
  • reconfigure the app.js file
  • refactor some relative pathes in your Express app
@grantland
grantland / post.md
Last active February 9, 2023 05:09
RecyclerView item onClick

RecyclerView item onClick

RecyclerView does not have an OnItemClickListener like it's predecessor, ListView. However, detecting item clicks is pretty simple.

Set an OnClickListener in your ViewHolder creation:

private class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder>  {

    public static class ViewHolder extends RecyclerView.ViewHolder
@JeffPaine
JeffPaine / us_state_abbreviations.py
Last active June 30, 2024 01:33
A python list of all US state abbreviations.
# United States Postal Service (USPS) abbreviations.
abbreviations = [
# https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States#States.
"AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "IA",
"ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO",
"MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK",
"OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VA", "VT", "WA", "WI",
"WV", "WY",
# https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States#Federal_district.
"DC",
@michaelt
michaelt / latex.template
Created June 9, 2011 21:23
Simple Pandoc default.latex with comments
%!TEX TS-program = xelatex
\documentclass[12pt]{scrartcl}
% The declaration of the document class:
% The second line here, i.e.
% \documentclass[12pt]{scrartcl}
% is a standard LaTeX document class declaration:
% we say what kind of document we are making in curly brackets,
% and specify any options in square brackets.