Skip to content

Instantly share code, notes, and snippets.

View oozzal's full-sized avatar
🇳🇵
learning

Uzzal Devkota oozzal

🇳🇵
learning
View GitHub Profile
@oozzal
oozzal / pull_apk.md
Last active May 6, 2022 16:32
Pull Apk from device
  1. Determine the package name of the app, e.g. "com.example.someapp". Skip this step if you already know the package name.

adb shell pm list packages

Look through the list of package names and try to find a match between the app in question and the package name. This is usually easy, but note that the package name can be completely unrelated to the app name. If you can't recognize the app from the list of package names, try finding the app in Google Play using a browser. The URL for an app in Google Play contains the package name.

  1. Get the full path name of the APK file for the desired package.
@oozzal
oozzal / jr_erb_fix.rb
Created August 5, 2014 11:58
.js.erb file not executing solution
# http://stackoverflow.com/questions/18936633/rails-update-js-erb-not-executing-javascript
# http://stackoverflow.com/questions/3412375/jquery-ajax-haml-js-erb-files-not-firing
# IN SHORT:
# use the following code in controller:
respond_to do |format|
format.html
@oozzal
oozzal / array_sum.js
Created July 15, 2015 12:02
Recursive Array Sum in Javascript
function arraySum(arr) {
if(typeof arr == 'number') return arr;
return arr.filter(function(item) {
return Array.isArray(item) || Number.isFinite(item);
}).reduce(function(memo, item) {
return memo + arraySum(item);
}, 0);
}
var arr = [7,4,1, [3,true,2], 1, '123'];
alert(arraySum(arr));
@oozzal
oozzal / agar_skins_loop.js
Created October 31, 2016 07:12
Agario Change Skins Continuously
Array.prototype.random = function () {
return this[Math.floor((Math.random()*this.length))];
}
skins = ['poland', 'usa', 'china', 'russia', 'canada', 'australia', 'spain', 'brazil', 'germany', 'ukraine', 'france', 'sweden', 'chaplin', 'north korea', 'south korea', 'japan', 'united kingdom', 'earth', 'greece', 'latvia', 'lithuania', 'estonia', 'finland', 'norway', 'cia', 'maldivas', 'austria', 'nigeria', 'reddit', 'yaranaika', 'confederate', '9gag', 'indiana', '4chan', 'italy', 'ussr', 'bulgaria', 'tumblr', '2ch.hk', 'hong kong', 'portugal', 'jamaica', 'german empire', 'mexico', 'sanik', 'switzerland', 'croatia', 'chile', 'indonesia', 'bangladesh', 'thailand', 'iran', 'iraq', 'peru', 'moon', 'botswana', 'bosnia', 'netherlands', 'european union', 'taiwan', 'pakistan', 'hungary', 'satanist', 'qing dynasty', 'matriarchy', 'patriarchy', 'feminism', 'ireland', 'texas', 'facepunch', 'prodota', 'cambodia', 'steam', 'piccolo', 'ea', 'india', 'kc', 'denmark', 'quebec', 'ayy lmao', 'sealand', 'bait', 'tsarist russia',
@oozzal
oozzal / bootstrap-modal.js
Created March 13, 2016 08:12
Ember Simple Bootstrap Modal Component
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement: function() {
var self = this;
this.$('.modal')
.modal('show')
.on('hide.bs.modal', function() {
self.sendAction('onModalClose');
});
@oozzal
oozzal / ruby_setup.md
Created February 1, 2016 10:50 — forked from julionc/ruby_setup.md
Deploy Ruby On Rails on Ubuntu 14.04

Deploy Ruby On Rails on Ubuntu 14.04

Server: Nginx with Phusion Passenger

Ruby Version: 2.1.3

User System: deploy

User System

@oozzal
oozzal / game.js
Created January 22, 2014 11:20
Quintus Ball Animation
var Q = Quintus().include("Sprites").setup({maximize: true});
// My extended module
Q.Sprite.extend("MySprite", {
orientation: {
horizontal: 'h',
vertical: 'v'
},
leftEdge: function() {
@oozzal
oozzal / iterate_file_system
Last active December 21, 2015 02:58
Ruby - working with files and directories.
child_folders = Dir[File.join(path, "*")].select{|file| File.ftype(file) == "directory"}.collect{|name| name.split("/").last}
child_files = Dir[File.join(path, "*")].select{|file| File.ftype(file) == "file"}.collect{|name| name.split("/").last}
class MyException < Exception
end
class YourException < Exception
end
begin
raise MyException if 2 > 50
raise YourException if 1 < 90
rescue MyException
@oozzal
oozzal / benchmark.rb
Last active August 29, 2015 14:18 — forked from aboltart/gist:f90cab21db56073ff947
Ruby Benchmarking Test Cases.
#===========================================
# 1. Benchmark
#
require 'benchmark'
Benchmark.bmbm do |x|
x.report ('<<') do
1_000_000.times do
one = 'one'
two = 'two'