Skip to content

Instantly share code, notes, and snippets.

Remo Harsono remoharsono

  • Oprent
  • Indonesia
Block or report user

Report or block remoharsono

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@remoharsono
remoharsono / ldap_search.php
Created Oct 21, 2019
My LDAP Search Implementing Pagination
View ldap_search.php
<?php
define("LDAP_HOST","mycompany.co.id");
define("LDAP_PORT", "389");
define("BASE_DN", "dc=mycompany,dc=co,dc=id");
define("PAGE_SIZE", 100); // limit
define("LDAP_USER", "username@mycompany.co.id");
define("LDAP_PASSWORD", 'secret');
@remoharsono
remoharsono / ldap.php
Last active Oct 18, 2019
PHP: Login to LDAP
View ldap.php
define("LDAP_HOST", "ldap://mydomain.co.id:389");
define("LDAP_VERSION", 3);
function authLDAP($ldap_username, $ldap_password) {
$ret = array();
if ($ldap_connection = ldap_connect(LDAP_HOST)) {
ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, LDAP_VERSION);
if ($ldap_bind = @ldap_bind($ldap_connection, $ldap_username, $ldap_password)) {
$ret['result'] = 'OK';
@remoharsono
remoharsono / gist:ec3631383481920aa458762b7caba19c
Created Aug 13, 2019 — forked from niczak/gist:2003485
PHP/SOAP and Microsoft Exchange
View gist:ec3631383481920aa458762b7caba19c
<?php
/*
test.php
Proof of concept testing to see if we can get
PHP/SOAP talking to EWS. Thanks to Thomas Rabaix
for his documentation on NTLM auth in SOAP and to
Erik Cederstrand for his article on SOAP/Exchange.
@remoharsono
remoharsono / method_chaining.php
Created Aug 8, 2019
a simple sample of PHP Method Chaining
View method_chaining.php
<?php
// taken from: https://stackoverflow.com/questions/3724112/php-method-chaining
class DBManager
{
private $selectables = array();
private $table;
private $whereClause;
private $limit;
public function select() {
View axios_file_upload.html
<!DOCTYPE html>
<html>
<head><title>.</title>
<meta charset="UTF-8">
</head>
<body>
<input type="file" name="filename" id="fileName">
<input type="button" value="Upload" onclick="btnUpload_click()">
@remoharsono
remoharsono / curl.md
Created Jul 17, 2019 — forked from subfuzion/curl.md
curl POST examples
View curl.md

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

View sanitize_filename.php
function sanitize_file_name( $filename ) {
$filename_raw = $filename;
$special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', chr( 0 ) );
/**
* Filters the list of characters to remove from a filename.
*
* @since 2.8.0
*
* @param array $special_chars Characters to remove.
* @param string $filename_raw Filename as it was passed into sanitize_file_name().
@remoharsono
remoharsono / instagram_mine.py
Created Apr 18, 2019 — forked from rubinovitz/instagram_mine.py
A python script for downloading all of the instagram photos of a certain hashtag I wrote for a friend in 20 minutes (forgive sloppiness). Warning: you're only allowed 30 API requests an hour. Requires your own access token set as environment variable "access_token".
View instagram_mine.py
from datetime import datetime
import urllib2
import urllib
import json
import os
def ajaxRequest(url=None):
"""
Makes an ajax get request.
url - endpoint(string)
@remoharsono
remoharsono / supervisord.conf
Created Mar 20, 2019 — forked from lenciel/supervisord.conf
supervisor configuration file for sentry
View supervisord.conf
;Notes:
; - Shell expansion ("~" or "$HOME") is not supported. Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".
; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
;
; Put this file in /etc/supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
@remoharsono
remoharsono / example_image_utils.py
Created Mar 16, 2019 — forked from turicas/example_image_utils.py
Layer on top of Python Imaging Library (PIL) to write text in images easily
View example_image_utils.py
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText
You can’t perform that action at this time.