Skip to content

Instantly share code, notes, and snippets.

View ma1onso's full-sized avatar
💜

Alonso ma1onso

💜
View GitHub Profile

A good commit message looks like this:

Header line: explaining the commit in one line

Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.

The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
@AaronGhent
AaronGhent / exacttarget.py
Created August 22, 2012 23:27
ExactTarget API
# >><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><< #
# ExactTarget API
# Author: Aaron Ghent
# Libraries Needed: suds
# CLI Install: ( pip install suds )
# >><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><< #
from django.conf import settings
from suds.client import Client
@bsnux
bsnux / gist:4672788
Created January 30, 2013 11:49
Storing Django queryset in session. Useful when you need to pass querysets between requests
import pickle
# Session key
key = 'my_qs'
# Pizza => model example
qs = Pizza.objects.filter(ingredient='tomato')
# Dumping data
request.session[key] = pickle.dumps(qs.query)
@rdb
rdb / js_linux.py
Last active May 17, 2024 03:24
Access joysticks/game controllers from Python in Linux via the joystick driver. See https://discourse.panda3d.org/t/game-controllers-on-linux-without-pygame/14128
# Released by rdb under the Unlicense (unlicense.org)
# Based on information from:
# https://www.kernel.org/doc/Documentation/input/joystick-api.txt
import os, struct, array
from fcntl import ioctl
# Iterate over the joystick devices.
print('Available devices:')
@alexland
alexland / serialize-numpy-array.py
Last active November 28, 2023 07:12
serialize, persist, retrieve, and de-serialize a NumPy array as a binary string (any dimension, any dtype); exemplary use case: a web app calculates some result--eg, from a Machine Learning algorithm, using NumPy and the result is a NumPy array; it is efficient to just return that result to rather than persist the array then retrieve it via query
import time
import numpy as NP
from redis import StrictRedis as redis
# a 2D array to serialize
A = 10 * NP.random.randn(10000).reshape(1000, 10)
# flatten the 2D NumPy array and save it as a binary string
array_dtype = str(A.dtype)
@hayderimran7
hayderimran7 / gist:9246dd195f785cf4783d
Created February 13, 2015 22:38
How to solve "sudo: no tty present and no askpass program specified" when trying to run a shell from Jenkins
Running shell scripts that have contain sudo commands in them from jenkins might not run as expected. To fix this, follow along
Simple steps:
1. On ubuntu based systems, run " $ sudo visudo "
2. this will open /etc/sudoers file.
3. If your jenkins user is already in that file, then modify to look like this:
jenkins ALL=(ALL) NOPASSWD: ALL
4. save the file by doing Ctrl+O (dont save in tmp file. save in /etc/sudoers, confirm overwrite)
5. Exit by doing Ctrl+X
6. Relaunch your jenkins job
@wenzhixin
wenzhixin / ubuntu14.04-command-line-install-android-sdk
Last active July 4, 2024 05:29
Ubuntu 14.04 command line install android sdk
# install openjdk
sudo apt-get install openjdk-7-jdk
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
# install all sdk packages
@GilLevi
GilLevi / README.md
Last active July 25, 2023 18:05
Age and Gender Classification using Convolutional Neural Networks
@EvgenyOrekhov
EvgenyOrekhov / A simple Docker and Docker Compose install script for Ubuntu.md
Last active July 6, 2024 14:16
A simple Docker and Docker Compose install script for Ubuntu

A simple Docker and Docker Compose install script for Ubuntu

Usage

  1. sh install-docker.sh
  2. log out
  3. log back in

Links

# coding: utf-8
# FILE:
# -----
# /mnt/Vancouver/apps/Webcam-Face-Detect/webcam_cv3_v2_fps_v3.py
# FUNCTIONALITY:
# --------------
# * outputs webcam to screen and finds faces, eyes
# * writes webcam video to *.avi file (MJPG codec) via OpenCV/FourCC