Skip to content

Instantly share code, notes, and snippets.

View jljohnson's full-sized avatar

Jean-Luc Johnson jljohnson

View GitHub Profile
@jljohnson
jljohnson / php-referer.php
Created October 29, 2024 16:19 — forked from giventofly/php-referer.php
naive php referer
<?php
$httpReferer = (isset($_SERVER['HTTP_REFERER']) && ((strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) !== false)) ? $_SERVER['HTTP_REFERER'] : null;
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Sirkulasi extends CI_Controller{
public $dpost;
public function __construct()
{
parent::__construct();
$this->dpost = $this->input->post(null,true);
@jljohnson
jljohnson / it-ebooks.md
Created July 20, 2021 15:05 — forked from baiwfg2/it-ebooks.md
Download ebooks as you want
@jljohnson
jljohnson / writexml.py
Created July 13, 2021 19:57 — forked from roskakori/writexml.py
Different variants of writting XML in Python
# -*- coding: utf-8 -*-
'''
Example code to write large output in XML with Unicode and namespaces.
This code has been referenced in a lightning talk I gave at EuroPython 2012
in Florence.
'''
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
@jljohnson
jljohnson / linebreak.md
Created July 22, 2020 08:04
Line breaks in markdown
Hello  (<-- two spaces)
World

Hello
World


Windows to UNIX Command Cheat Sheet

Windows PowerShell has several transition aliases that allow UNIX and CMD users to use familiar command names in Windows PowerShell. The most common aliases are shown in the table below, along with the Windows PowerShell command behind the alias and the standard Windows PowerShell alias if one exists.

CMD Command UNIX Command PowerShell Command PowerShell Alias
dir ls Get-ChildItem gci
@jljohnson
jljohnson / LdapAuth.java
Created October 22, 2018 11:57 — forked from jbarber/LdapAuth.java
LDAP example for searching and simple binding (authentication)
/*
* First create the keystore (to allow SSL protection) by importing the LDAP
* certificate (cert.pem) with:
* keytool -import -keystore keystore -storepass changeit -noprompt -file cert.pem
*
* You can get the certificate with OpenSSL:
* openssl s_client -connect ldap.server.com:636 </dev/null 2>/dev/null | sed -n '/^-----BEGIN/,/^-----END/ { p }' > cert.pem
*
* Then compile this class with:
* javac LdapAuth.java
@jljohnson
jljohnson / Gruntfile.js
Created August 20, 2018 21:21 — forked from firstred/Gruntfile.js
Gruntfile for mdstripe module
module.exports = function(grunt) {
grunt.initConfig({
compress: {
main: {
options: {
archive: 'mdstripe.zip'
},
files: [
{src: ['controllers/**'], dest: 'mdstripe/', filter: 'isFile'},
@jljohnson
jljohnson / twitter_oauth_timeline
Created July 19, 2018 12:48
twitter - abraham/twitteroauth - get timeline
function getTwitterTimeline($userName) {
$consumer_key = '';
$consumer_secret = '';
$oauth_token = '';
$oauth_secret = '';
// options
$number = 5;
$exclude_replies = 'false';
$screenname = (isset($userName)) ? '&screen_name='.$userName : '';
<?php
use Abraham\TwitterOAuth\TwitterOAuth;
$tweet="this is a test tweet";
$connection = new TwitterOAuth(/*CONSUMER_KEY*/, /*CONSUMER_SECRET*/, /*ACCESS_TOKEN*/, /*ACCESS_TOKEN_SECRET*/);
$content = $connection->get('account/verify_credentials');
$connection->post('statuses/update', array('status' => $tweet));
?>