Skip to content

Instantly share code, notes, and snippets.

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

Agung Yuliaji agungyuliaji

🏠
Working from home
View GitHub Profile
@jourdein
jourdein / gist:5412399
Last active December 21, 2016 01:35
Postgresql 9.1 On Ubuntu 12.10 Linux (Quantal Quetzal)
# STEP 1: VERIFY THAT YOU DO NOT ALREADY HAVE POSTGRESQL INSTALLED ON YOUR SYSTEM
ps ax | grep postgres
# STEP 2: INSTALL POSTGRESQL ON YOUR SYSTEM
sudo apt-get update
sudo apt-get install postgresql-9.1
# List All Postgres related packages
dpkg -l | grep postgres
@guzart
guzart / download
Created March 21, 2012 17:14
bash: Download and Compress Rails API
#!/bin/bash
rm -rf api.rubyonrails.org/
wget -r -k -p http://api.rubyonrails.org/
rm rails_api.rar
rar a -r rails_api.rar api.rubyonrails.org/
namespace :routes do
desc 'Print out all defined routes in match order, with names, per constraint class. Target specific constraint class with CONSTRAINT=x. Target specific controller with CONTROLLER=x.'
task constrained: :environment do
Rails.application.reload_routes!
constraints_routes = Hash.new
Rails.application.routes.routes.each do |route|
group = (route.app.class == ActionDispatch::Routing::Mapper::Constraints ? route.app.send( :constraints ).first.to_s : 'No constraint class')
constraints_routes[group] ||= []
@aliang
aliang / mymodel.rb
Created June 13, 2011 06:25
render from model in Rails 3
# yes, sometimes you need to do this. you get pilloried in a forum if you
# ask about it, though!
# this code taken from
# http://wholemeal.co.nz/blog/2011/04/05/rendering-from-a-model-in-rails-3/
class MyModel < ActiveRecord::Base
# Use the my_models/_my_model.txt.erb view to render this object as a string
def to_s
ActionView::Base.new(Rails.configuration.paths.app.views.first).render(
@amiel
amiel / my_uploader.rb
Created May 22, 2012 20:51
Simple watermarking with Thumbkit and CarrierWave
class MyUploader < CarrierWave::Uploader::Base
include Thumbkit::Adapters::CarrierWave
# Watermark should always be processed after thumbkit, ensuring that we always
# have a valid image and we don't need to change the extension
def watermark(watermark_image, options = {})
cache_stored_file! if !cached?
Watermarker.new(current_path, watermark_image).watermark!(options)
end
@bitoiu
bitoiu / self-signed-wildcard-cert-for-ghes.md
Last active September 19, 2023 09:37
Self-Signed Wildcard certificate with SAN using openssl / SSL

Copy the default template of openssl.cnf to a writable location.

cp /System/Library/OpenSSL/openssl.cnf src

Uncomment the req_extensions = v3_req

req_extensions = v3_req # The extensions to add to a certificate request

Add subjectAltName to v3_req section

@chaintng
chaintng / javascript.js
Created June 9, 2018 05:34
Encryption Decryption Javascript and Ruby
// IDEA FROM: https://stackoverflow.com/questions/33929712/crypto-in-nodejs-and-ruby
var crypto = require('crypto'),
algorithm = 'aes-256-cbc',
key = 'SOME_RANDOM_KEY_32_CHR_123456789', // 32 Characters
iv = "0000000000000000"; // 16 Characters
function encrypt(text){
var cipher = crypto.createCipheriv(algorithm,key,iv)
var crypted = cipher.update(text,'utf-8',"base64")
@PuKoren
PuKoren / recompile-and-run.sh
Last active January 17, 2024 19:01
Recompile APK + Sign with apktool
# You must first install apktool (https://github.com/iBotPeaches/Apktool) and android SDK
# and decompile apk using it
# apktool d -rf my-app.apk
# then generate a key for sign in:
# keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
rm signed-app.apk
apktool b -f -d com.myapp
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore com.myapp/dist/com.myapp.apk alias_name
zipalign -v 4 com.myapp/dist/com.myapp.apk signed-app.apk
@pboling
pboling / slim_vs_haml.md
Last active February 11, 2024 16:33
Slim vs Haml

Analysis of Slim vs. Haml Project Health

  • Static data as of April 13, 2015, some updates as of October 1, 2015
# Metric Haml Slim Winner
1 Issues Open Issues Open Issues Slim
2 Stars Stars Open Issues Slim
3 Quality Code Climate technical debt Code Climate maintainability -- Haml
4 Test Coverage ![Code Climate coverage](https://i
@wbroek
wbroek / genymotionwithplay.txt
Last active February 12, 2024 03:22
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)