Skip to content

Instantly share code, notes, and snippets.

View joffilyfe's full-sized avatar

Joffily joffilyfe

  • 20:36 (UTC +01:00)
View GitHub Profile
@artschwagerb
artschwagerb / gist:35130c93b276d6aa2b05
Created January 28, 2015 18:25
Python LDAP - Change Password
def changePassword(user_dn, old_password, new_password):
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)
l = ldap.initialize("LDAPS://DOMAIN.COM")
l.set_option(ldap.OPT_REFERRALS,0)
l.set_option(ldap.OPT_PROTOCOL_VERSION,3)
l.set_option(ldap.OPT_X_TLS,ldap.OPT_X_TLS_DEMAND)
l.set_option(ldap.OPT_X_TLS_DEMAND,True)
l.set_option(ldap.OPT_DEBUG_LEVEL,255)
l.simple_bind_s("[email protected]", "PASSWORD")
@martinrusev
martinrusev / cron_supervisord.ini
Last active March 18, 2025 07:21
Cron supervisord
[supervisord]
nodaemon=true
loglevel=debug
[program:amon]
command=gunicorn -c gunicorn.conf.py wsgi
directory=/amon
autostart=true
autorestart=true
redirect_stderr=true
@filipkral
filipkral / convert_sp_geojson.r
Last active May 17, 2021 15:21
Convert between geojson and sp spatial objects in R
# Convert between geojson and sp spatial objects in R
require(rgdal)
# https://stat.duke.edu/~cr173/Sta523_Fa14/spatial_data.html
s <- '{ "type": "MultiPolygon", "coordinates": [
[ [[40, 40], [20, 45], [45, 30], [40, 40]] ],
[ [[20, 35], [10, 30], [10, 10], [30, 5], [45, 20], [20, 35]],
[[30, 20], [20, 15], [20, 25], [30, 20]]
]
]}'
@NotSqrt
NotSqrt / settings_test_snippet.py
Last active May 1, 2022 01:34 — forked from nealtodd/settings_test_snippet.py
Another shot at this problem ..
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return "notmigrations"
MIGRATION_MODULES = DisableMigrations()
@artemave
artemave / carrierwave.rb
Last active February 10, 2023 21:08
minimagick carrierwave round image (with white border)
# config/initializers/carrierwave.rb
require 'mini_magick'
module CarrierWave
module MiniMagick
# round _square_ image
def round
manipulate! do |img|
img.format 'png'
@itarato
itarato / encryption.java
Created September 28, 2014 18:59
Java AES CBC encryption example
package com.company;
import javax.crypto.Cipher;
import javax.crypto.Mac;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.MessageDigest;
import java.security.SecureRandom;
public class Main {
@dweymouth
dweymouth / AES.java
Created April 19, 2014 16:18
A Java class to perform password-based AES encryption and decryption
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <[email protected]> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. D. Weymouth 4/2014
* ----------------------------------------------------------------------------
*/
import java.io.*;
@wbroek
wbroek / genymotionwithplay.txt
Last active February 13, 2025 09:37
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@clayperez
clayperez / zebraRFID.js
Created November 22, 2013 01:27
ZEBRA COMMAND LINE RFID PRINT UTILITY Needs some cleanup work, but this handy script lets you execute simple print commands to a Zebra RFID printer that is connected to your computer.
///////////////////////////////////////
// RFID PRINTER COMMAND LINE UTILITY //
///////////////////////////////////////
// REQUIRES: node-printer by tojocky
// USAGE: node zebra.js <printer> <start> <end> <file.csv> <print/null>
//
// RANGE EXAMPLE prints range to screen only:
// C:> node zebra zebra 1 100
//
// RANGE EXAMPLE prints range:
@timothyandrew
timothyandrew / README.md
Last active December 16, 2023 17:05
Set up a seedbox (on DigitalOcean – Ubuntu) really quick

Introduction

  • This script lets you set up and use a temporary DigitalOcean droplet to download torrent files.
  • Once downloaded, they can be streamed down to your local machine.
  • This uses transmission-cli for the torrent client, and nginx to serve files.

Setup on Local Machine

  • This assumes that you have a DigitalOcean account and tugboat set up, as well as seedbox-setup.sh present in the current directory.