Skip to content

Instantly share code, notes, and snippets.

Andrey Chernih andreychernih

Block or report user

Report or block andreychernih

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
View self-signed-certificate-with-custom-ca.md

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@andreychernih
andreychernih / default.rb
Created Mar 26, 2014
Install and compile TBB for android
View default.rb
default[:tbb][:version] = '4.2-20140122oss'
default[:tbb][:url] = 'https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb42_20140122oss_src.tgz'
default[:tbb][:sha] = 'f1bd8d983f93a10e340ba63f3a479632ddca1562a5242814dd82a378d3233b75'
@andreychernih
andreychernih / active_admin.en.yml
Created Mar 17, 2014
Add "not equals" option to ActiveAdmin string filter
View active_admin.en.yml
en:
active_admin:
filters:
predicates:
not_eq: "Not equals"
@andreychernih
andreychernih / carrierwave.rb
Created Jul 1, 2011
Change image quality with carrierwave and mini_magick
View carrierwave.rb
# put this in config/initializers/carrierwave.rb
module CarrierWave
module MiniMagick
def quality(percentage)
manipulate! do |img|
img.quality(percentage)
img = yield(img) if block_given?
img
end
end
@andreychernih
andreychernih / MY_Exceptions.php
Created Apr 3, 2012
CodeIgniter error notifications
View MY_Exceptions.php
<?php
class MY_Exceptions extends CI_Exceptions {
function My_Exceptions()
{
parent::CI_Exceptions();
}
function show_error($heading, $message, $template = 'error_general', $status_code = 500)
{
@andreychernih
andreychernih / default.rb
Created Jul 20, 2012
Easy way to edit configuration file with Chef
View default.rb
add_line = "config statement"
bash "add_to_config" do
code <<-EOH
grep '#{add_line}' /etc/config || echo '#{add_line}' >> /etc/config
EOH
end
@andreychernih
andreychernih / search.feature
Created Sep 8, 2016
How to test a website blog post
View search.feature
Feature: Search
Scenario: Search for "apple"
Given I am on the front page
When I search for "apple"
Then I should see "apple.com"
@andreychernih
andreychernih / Dockerfile
Created Aug 29, 2016
docker osxfs slowness workaround
View Dockerfile
ENV APP_USER app
ENV BUNDLE_APP_CONFIG /usr/local/bundle
ADD Gemfile $DIR
ADD Gemfile.lock $DIR
# Force bundler to install all gems to system location (/usr/local/bundle) so that when you run `rake` command
# all files are loaded from docker image instead of mounted volume
RUN bundle install --deployment --path $BUNDLE_APP_CONFIG
RUN chown -R $APP_USER $BUNDLE_APP_CONFIG
View MediaRecorderExample.java
MediaRecorder mediaRecorder = new MediaRecorder();
CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
profile.videoFrameWidth = 1280;
profile.videoFrameHeight = 720;
mediaRecorder.setCamera(Camera.open());
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mediaRecorder.setProfile(profile);
View JcodecMp4VideoMuxer.java
public class JcodecMp4VideoMuxer implements VideoMuxer {
private FileChannelWrapper mChannelWrapper;
private MP4Muxer mMp4Muxer;
private FramesMP4MuxerTrack mMp4Track;
private ArrayList<ByteBuffer> mSpsList;
private ArrayList<ByteBuffer> mPpsList;
@Override
public boolean initialize() {
mSpsList = new ArrayList<ByteBuffer>();
You can’t perform that action at this time.