Skip to content

Instantly share code, notes, and snippets.

@Kennyl
Kennyl / aes.js
Last active August 29, 2015 14:01
Various Script Language for AES256
var crypto = require('crypto');
var data = "中あ";
// data="bestwellgoodwill"
console.log('Original cleartext: ' + data);
var algorithm = 'aes-256-cbc';
var key = 'hello';
var clearEncoding = 'utf8';
//var cipherEncoding = 'hex';
//If the next line is uncommented, the final cleartext is wrong.
var cipherEncoding = 'binary';// or base64
@Kennyl
Kennyl / build
Last active August 29, 2015 14:01
Pixmicat Openshift Build Script
#!/bin/bash -e
echo "### Download Pixmicat"
curl -o ${OPENSHIFT_DATA_DIR}/pixmicat.zip https://codeload.github.com/Kennyl/pixmicat/zip/develop
curl -o ${OPENSHIFT_DATA_DIR}/pixmicat_modules.zip https://codeload.github.com/Kennyl/pixmicat_modules/zip/develop
pushd ${OPENSHIFT_DATA_DIR}
//-----------------------------------------------//
// I2C / SPI LCD BACKPACK LIBRARY FOR SPARK CORE //
//===============================================//
// Copy this into a new application at: //
// https://www.spark.io/build and go nuts! //
// !! Pinouts on line 427 below !! //
//-----------------------------------------------//
// Technobly / BDub - Jan 16th 2014 //
//===============================================//
@Kennyl
Kennyl / gist:96d4b1ef778bf8f8156a
Created August 6, 2015 03:25
One liner Change commiter name
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='nobody'; GIT_AUTHOR_EMAIL='nobody@localhost'; GIT_COMMITTER_NAME='nobody'; GIT_COMMITTER_EMAIL='nobody@localhost';" HEAD
@Kennyl
Kennyl / gist:913b8d906de8ff4f772d2d8dfec90235
Created September 12, 2016 09:49
php memcached with sasl on openshift (notworking)
#openshift instead php mod memcached
#need compile following
#apt-get install libsasl2-2 sasl2-bin libsasl2-2 libsasl2-dev libsasl2-modules libevent-dev
# libsasl2-2 sasl2-bin libsasl2-modules
pushd ${OPENSHIFT_RUNTIME_DIR}/tmp
wget ftp://ftp.cyrusimap.org/cyrus-sasl/cyrus-sasl-2.1.26.tar.gz
tar -zxf cyrus-sasl-2.1.26.tar.gz
cd cyrus-sasl-2.1.26
@Kennyl
Kennyl / wit-telegram-bot.js
Created January 31, 2017 12:03 — forked from dotcypress/wit-telegram-bot.js
How to build Telegram bot with Wit.ai Bot Engine
// npm install telegraf telegraf-wit
var Telegraf = require('telegraf')
var TelegrafWit = require('telegraf-wit')
var app = new Telegraf(process.env.BOT_TOKEN)
var wit = new TelegrafWit(process.env.WIT_TOKEN)
app.use(Telegraf.memorySession())
@Kennyl
Kennyl / emailprotection.js
Last active February 14, 2017 15:30
Simple Email Link Protection as well as Any A href
// use it on mouser over will replace all whitespace when human interacts it
this.href='mailto:'+ (this.innerHTML=this.innerHTML.replace(/ /g,''))
/*<a id="e" href="#" onmouseover="this.href='mailto:'+ (this.innerHTML=this.innerHTML.replace(/ /g,''))">abc @ efg.com</a>*/
@Kennyl
Kennyl / gist:eda52972616d19e3b12010e0048f85d3
Created February 21, 2017 14:32
Most Update ebooklib for python3
pip3 install --upgrade git+https://github.com/aerkalov/ebooklib
@Kennyl
Kennyl / gif2png.py
Created February 21, 2017 15:10
Sample for python Gif to PNG
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PIL import Image, ImageDraw, ImageFont #dynamic import
gif='a.gif'
img = Image.open(gif)
img.save(gif+".png",'png', optimize=True, quality=70)
@Kennyl
Kennyl / cleangit.sh
Created February 25, 2017 09:03
Clean git like nothing again.
git checkout --orphan tmp
git add .
git commit -m "init"
git push --force --set-upstream origin master
git branch -d master
git branch -m tmp master