Skip to content

Instantly share code, notes, and snippets.

View ralic's full-sized avatar
🏠
Working from home

Ralic Lo ralic

🏠
Working from home
View GitHub Profile
@ralic
ralic / nectec-apache-2.0
Created December 4, 2016 10:56 — forked from piruin/nectec-apache-2.0
Intellij IDEA copyright profiles of NECTEC's Apache 2.0 License in Velocity templates
Copyright (c) $today.year NECTEC
National Electronics and Computer Technology Center, Thailand
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@ralic
ralic / ocr.rb
Created February 22, 2017 09:05 — forked from jyunderwood/ocr.rb
require 'base64'
require 'open-uri'
require 'net/http'
require 'net/https'
require 'json'
class OCR
attr_reader :api_key, :image_url
def self.scan(api_key:, image_url:)
@ralic
ralic / nginx.conf
Created February 22, 2017 09:06
Mobile redirection with Nginx
server {
listen 80 default deferred;
server_name www.example.com;
root /home/example/app/example_app/public;
## Start mobile redirection code
set $mobile_request false;
set $mobile_cookie "";
if ($http_user_agent ~* '(Mobile|WebOS)') {
@ralic
ralic / Spark+ipython_on_MacOS.md
Created April 16, 2017 05:52 — forked from ololobus/Spark+ipython_on_MacOS.md
Apache Spark installation + ipython/jupyter notebook integration guide for macOS

Apache Spark installation + ipython/jupyter notebook integration guide for macOS

Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112

For older versions of Spark and ipython, please, see also previous version of text.

Install Java Development Kit

@ralic
ralic / weasyprint.txt
Created April 18, 2017 10:36 — forked from ammaaim/weasyprint.txt
Python3 HTML to PDF generator
>>> INSTALL
pip3.4 install weasyprint
>>> EXAMPLE
from weasyprint import HTML, CSS
html_src='''
<h1>The title</h1>
<p>Content goes here
@ralic
ralic / j2objc.rb
Created April 28, 2017 07:47 — forked from bsorrentino/j2objc.rb
J2OBJC FORMULA (HOMEBREW)
# Documentation: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md
# /usr/local/Library/Contributions/example-formula.rb
#
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
#
# FOR LOCAL INSTALLATION COPY IT IN /usr/local/Library/Formula/
#
class J2objc < Formula
homepage "http://j2objc.org/"
@ralic
ralic / svn-to-git.md
Created May 2, 2017 08:51 — forked from barrysteyn/svn-to-git.md
Migrate From SVN To GIT
@ralic
ralic / config.js
Created May 2, 2017 23:10 — forked from jasonphillips/config.js
Jupyter NodeJS: HTML Output (and React Demonstration)
module.exports = {
extensions: {
// clojurescript: require('./ext/clojurescript'),
clojure: require('./build/ext/clojure'),
clojurescript: require('./build/ext/clojurescript'),
coffee: require('./build/ext/coffee'),
babel: require('./build/ext/babel'),
html: require('./build/ext/html')
}
}
@ralic
ralic / APFS.swift
Created May 24, 2017 09:37 — forked from banjun/APFS.swift
Is your device using Apple File System (APFS)?
// the original code by apple and its license
// https://developer.apple.com/library/prerelease/content/samplecode/APFSCloning/Listings/clonefile_main_c.html#//apple_ref/doc/uid/TP40017341-clonefile_main_c-DontLinkElementID_5
NSLog("%@", "\(ProcessInfo().operatingSystemVersion)")
/* Initailize state */
let s = copyfile_state_alloc();
let srcPath = NSHomeDirectory() + "/tmp/test.txt"
let copyPath = NSHomeDirectory() + "/tmp/test-copy.txt"
@ralic
ralic / client.sh
Created November 25, 2017 11:45 — forked from leonklingele/client.sh
netcat – encrypt transfer with openssl
IP="127.0.0.1"
PORT="8877"
SHARED_SECRET="shared secret"
OPENSSL="/usr/local/opt/libressl/bin/openssl"
OPENSSL_CMD="$OPENSSL enc -a -A -aes-256-gcm"
while IFS= read -r MSG; do
echo "$MSG" | $OPENSSL_CMD -e -k "$SHARED_SECRET"
echo