Skip to content

Instantly share code, notes, and snippets.

View 101t's full-sized avatar
🐍
Simple is better than complex!

Tarek Kalaji 101t

🐍
Simple is better than complex!
View GitHub Profile
import re
from io import StringIO
from decimal import Decimal
# TODO:
# - investigate: late column casts better than early? (make temp table all text?)
# - encoder/decoder for all django field types
# - sanitize method interfaces of CopyConverter / more django-like
# - Do we need a temp file shim instead of StringIO for very big data?
# - Better with ByteIO instead of StringIO?
@josehbez
josehbez / odoo-module-packaging.py
Last active February 1, 2024 02:06
A simple python script that compress odoo module with its dependency modules in a file ZIP.
# -*- coding: utf-8 -*-
#! /bin/env python3
import ast
import os
import zipfile
from datetime import datetime
import sys
help="""Odoo Module Packaging by https://github.com/josehbez
@shakna-israel
shakna-israel / Prose.md
Created October 23, 2019 23:32
Obfuscating Lua

Obfuscating Lua

I've had some fun ruining Python recently, but Python is what I use at work. I prefer to use other languages when I'm doing stuff for fun.

And obfuscation only really makes sense in fun and competition - given a suffeciently determined actor, your code will be reverse engineered. Unless you write it in Malboge.

For this particular experiment, I'll be using Lua 5.3. As I'll probably need to dive into some of the less portable functions to commit our atrocities, I can't guarantee it will run on other popular versions like Luajit or 5.1.


@shakna-israel
shakna-israel / Prose.md
Last active November 15, 2023 22:06
Obfuscating Python

Obfuscating Python

Obfuscation isn't difficult in most programming languages. It's why we have "good practices" because it is so easy to hide what you mean in badly written code.

Obfuscation tends to be even easier in dynamic languages because of how forgiving they tend to be - and because they tend to give you direct access to the environment so that you can manipulate it.

Today, for fun, I'm going to obfuscate this code:

def _(n):

if n <= 0:

@aish2997
aish2997 / PY0101EN-3-1-Conditions.ipynb
Created March 4, 2019 13:09
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mjbnz
mjbnz / nginx-rproxy-with-sso.md
Last active May 23, 2024 14:16
Nginx Reverse Proxy with simple SSO

Nginx Reverse Proxy for homelab services using SSO

NOTE: This document has now been added to the nginx-sso wiki, here. Any further updates will be made there.

Using:
@safebuffer
safebuffer / xml_json.py
Last active March 14, 2023 03:36
Nmap XML output to Json
import json,xmltodict
"""
Nmap XML Output to Json Output in Python
example : data = xml2json('nmap_output.xml')
"""
def xml2json(xml):
xmlfile = open(xml)
xml_content = xmlfile.read()
xmlfile.close()
xmljson = json.dumps(xmltodict.parse(xml_content), indent=4, sort_keys=True)
@worldadventurer
worldadventurer / freepbx-asterisk-install-g729-g723-codec.sh
Last active May 28, 2021 04:53
FreePBX Asterisk 13 install g729 & g723.1 codecs - open source versions
# This is for x64 Intel CPU with SSSE4 instructions
# To check your CPU type, run: cat /proc/cpuinfo and look for "sse4_1" in the "flags" line then this script works
# To check x32 vs x64, run: getconf LONG_BIT
# If your CPU isnt an x64 or have sse4 support, then get your .so file version at: http://asterisk.hosting.lv/
# Tested on Centos x64 - on a FreePBX Distro 13 x64
echo -------
echo This installs the open source version of the g729 and g723.1 codecs
echo You may need to buy licenses to use these codecs - it is your responsibility.
echo -------
read -rsp $'Press any key to continue OR CTRL-c to QUIT ...\n' -n1 key
@ankurk91
ankurk91 / github_gpg_key.md
Last active June 7, 2024 14:31
Signing git commits using GPG (Ubuntu/Mac)

Github : Signing commits using GPG (Ubuntu/Mac) 🔐

  • Do you have an Github account ? If not create one.
  • Install required tools
  • Latest Git Client
  • gpg tools
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/
@ohanetz
ohanetz / install-ffmpeg-ubuntu.sh
Created August 24, 2015 19:26
This script will install ffmpeg with all its dependencies on Ubuntu 14.04 server machine
#!/bin/bash
## Preparing Environment - this can be altered to match your installation ##
# Folder to store ffmpeg and dependency libraries sources in the process:
FFMPEG_SRC=~/ffmpeg
# Folder to install ffmpeg binary into:
FFMPEG_BIN=$HOME/bin
## Install dependencies and packages that can be installed by apt-get ##
sudo apt-get update