This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rails console - handy commands | |
# | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
# Change log level to debug | |
Rails.logger.level = Logger::DEBUG | |
# Print the line & file from where SQL got triggerred | |
ActiveRecord::Base.verbose_query_logs = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'time' | |
names = [] | |
Dir.glob('*').select { |f| File.file?(f)}.each do |fn| | |
file_name = fn.gsub('_', '') | |
timestamp = Time.parse(file_name[file_name.index('20200'), 14]) | |
ext = file_name.split(".").last.downcase | |
if ext == "mp4" | |
new_file_name = timestamp.strftime("VID%Y%m%d-%H%M%S") | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adb shell pm disable-user --user 0 com.oppo.market # Can not be disabled | |
adb shell pm disable-user --user 0 com.google.ar.core | |
adb shell pm disable-user --user 0 com.nearme.browser | |
adb shell pm disable-user --user 0 com.oppo.qualityprotect | |
adb shell pm disable-user --user 0 com.google.android.apps.wellbeing | |
adb shell pm disable-user --user 0 com.facebook.system | |
adb shell pm disable-user --user 0 com.facebook.services | |
adb shell pm disable-user --user 0 com.colouros.gamespace # Failed | |
adb shell pm disable-user --user 0 com.google.android.googlequick # Failed | |
adb shell pm disable-user --user 0 com.android.providers.partnerbookmarks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find requests for a Device/API | |
LOGFILE="log/development.log" | |
OUTPUT=$(grep -an 'Started PUT "/api/v1/users/information' $LOGFILE | grep -o "........-....-....-....-............" | awk 'ORS="|"') | |
OUTPUT=${OUTPUT%?}; | |
echo $OUTPUT | |
OUTPUT=$(egrep -an $OUTPUT $LOGFILE | grep 'userid => 15841' | grep -o "........-....-....-....-............" | awk 'ORS="|"') | |
OUTPUT=${OUTPUT%?}; | |
echo $OUTPUT | |
egrep -an $OUTPUT $LOGFILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"always_show_minimap_viewport": false, | |
"auto_complete": true, | |
"auto_complete_commit_on_tab": true, | |
"binary_file_patterns": | |
[ | |
"*.jpg", | |
"*.jpeg", | |
"*.png", | |
"*.gif", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'file-chunk'{1..19}'.ts' | tr " " "\n" > file_listing | |
cat file_listing | |
touch combined_test_file.ts | |
while read line; do cat $line >> combined_test_file.ts; done < file_listing | |
while read line; do rm -f $line; done < file_listing | |
rm -f file_listing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Generate Margin/Padding Classes | |
* margin, margin-top, margin-bottom, margin-left, margin-right | |
* padding, padding-top, padding-bottom, padding-left, padding-right | |
*/ | |
@mixin margin-padding($min, $max, $css-property, $klass, $csspx: $min) { | |
@while $min <= $max { | |
@if $min != 0 { |
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 30 in line 1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heroku pg:psql --app APP_NAME | |
\copy (SELECT users.id, CONCAT(first_name, ' ', middle_name, ' ', last_name) AS full_name, username, dob, gender, address_line_1, address_line_2, province, zipcode, email, phone_number, minor, roles.name as role, avatar_url, email_frequency, sign_in_count, license_code, city, elise_points, used_points, contact_person, phone, website, chamber_of_commerce_no, notes FROM users LEFT JOIN roles on role_id=roles.id) TO users-8feb-2016.csv CSV HEADER DELIMITER ',' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo -u postgres psql -d template1 -c "CREATE USER kalpesh WITH PASSWORD 'password' CREATEDB;" | |
sudo -u postgres psql -d template1 -c "CREATE DATABASE sample_db OWNER kalpesh;" | |
sudo -u postgres psql -d template1 -c "CREATE USER kalpesh CREATEDB;" | |
sudo -u postgres -H psql -d template1 | |
/* =========================== Users =========================== */ | |
/* Create User with password */ | |
CREATE USER kalpesh WITH PASSWORD 'kalpesh'; | |
/* Drop User */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('image-preview-demo',[]).directive('imgPreviewElem', [function () { | |
return { | |
restrict: 'AE', | |
link: function(scope, elem, attrs) { | |
console.log("directive called") | |
elem.bind('change', function () { | |
var file=elem[0].files[0], | |
imageType=/(image.jpeg|image.png|image.jpg)/, | |
imgElementId = attrs.imgPreviewElem; |
NewerOlder