Skip to content

Instantly share code, notes, and snippets.

View naveed-ahmad's full-sized avatar
🏋️‍♂️
hacking stuff

Naveed Ahmad naveed-ahmad

🏋️‍♂️
hacking stuff
View GitHub Profile
@naveed-ahmad
naveed-ahmad / sidekiq-cheatsheet.sh
Last active March 17, 2019 20:48 — forked from wbotelhos/clear-sidekiq-jobs.sh
Clear Sidekiq Jobs
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs
@naveed-ahmad
naveed-ahmad / list.txt
Last active June 12, 2018 18:42
Games
Pirates Adventure:
https://play.google.com/store/apps/details?id=com.gameslab.piratesadventure
https://goo.gl/V8TPX9
https://piratesadventure.page.link/qL6j
Fat Boy Dream:
https://play.google.com/store/apps/details?id=com.gameslab.fat_boy_dream
https://goo.gl/QReLcx
hash = {
":hash:" => '<span class="emojione-0023-20E3" title=":hash:">#⃣</span>',
":zero:" => '<span class="emojione-0030-20E3" title=":zero:">0⃣</span>',
":one:" => '<span class="emojione-0031-20E3" title=":one:">1⃣</span>',
":two:" => '<span class="emojione-0032-20E3" title=":two:">2⃣</span>', ":three:" => '<span class="emojione-0033-20E3" title=":three:">3⃣</span>', ":four:" => '<span class="emojione-0034-20E3" title=":four:">4⃣</span>', ":five:" => '<span class="emojione-0035-20E3" title=":five:">5⃣</span>', ":six:" => '<span class="emojione-0036-20E3" title=":six:">6⃣</span>', ":seven:" => '<span class="emojione-0037-20E3" title=":seven:">7⃣</span>', ":eight:" => '<span class="emojione-0038-20E3" title=":eight:">8⃣</span>', ":nine:" => '<span class="emojione-0039-20E3" title=":nine:">9⃣</span>', ":copyright:" => '<span class="emojione-00A9" title=":copyright:">©</span>', ":registered:" => '<span class="emojione-00AE" title=":registered:">®</span>', ":bangbang:" => '<span class="emoj
download= function() {
canvas=document.getElementById('canvas')
canvas.toBlob(function(blob) {
var anchor = document.createElement('a'),
dataUrl = URL.createObjectURL(blob),
fileName = 'canvas.png';
// set a attributes
anchor.setAttribute('href', dataUrl);
anchor.setAttribute('target', '_blank');
https://quran.com/3/8
رَبَّنَا لَا تُزِغْ قُلُوبَنَا بَعْدَ إِذْ هَدَيْتَنَا وَهَبْ لَنَا مِن لَّدُنكَ رَحْمَةً ۚ إِنَّكَ أَنتَ الْوَهَّابُ
اے ہمارے رب! ہمیں ہدایت دینے کے بعد ہمارے دل ٹیڑھے نہ کردے اور ہمیں اپنے پاس سے رحمت عطا فرما، یقیناً تو ہی بہت بڑی عطا دینے واﻻ ہے
https://quran.com/7/43
وَقَالُوا الْحَمْدُ لِلَّهِ الَّذِي هَدَانَا لِهَٰذَا وَمَا كُنَّا لِنَهْتَدِيَ لَوْلَا أَنْ هَدَانَا اللَّهُ
@naveed-ahmad
naveed-ahmad / codegolf.md
Created October 24, 2017 05:04 — forked from xem/codegolf.md
JS code golfing

codegolf JS

Mini projects by Maxime Euzière (xem), subzey, Martin Kleppe (aemkei), Mathieu Henri (p01), Litterallylara, Tommy Hodgins (innovati), Veu(beke), Anders Kaare, Keith Clark, Addy Osmani, bburky, rlauck, cmoreau, maettig, thiemowmde, ilesinge, adlq, solinca, xen_the,...

(For more info and other projects, visit http://xem.github.io)

(Official Slack room: http://jsgolf.club / join us on http://register.jsgolf.club)

@naveed-ahmad
naveed-ahmad / bench_rails_memory_usage.rb
Created October 1, 2017 21:58 — forked from brianhempel/bench_rails_memory_usage.rb
A script to test the memory usage of your Rails application over time. It will run 30 requests against the specified action and report the final RSS. Choose the URL to hit on line 45 and then run with `ruby bench_rails_memory_usage.rb`.
require "net/http"
def start_server
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
@naveed-ahmad
naveed-ahmad / gource.sh
Created September 30, 2017 16:57 — forked from XueshiQiao/gource.sh
Generate a MP4 Video for your Git project commits using Gource!
# 1.install gource using HomeBrew
$ brew install gource
# 2.install avconv
git clone git://git.libav.org/libav.git
cd libav
# it will take 3-5 minutes to complie, be patient.
./configure --disable-yasm
make && make install
@naveed-ahmad
naveed-ahmad / decryption.rb
Last active May 3, 2017 02:01
PHP encryption <=> Ruby decryption using aes 256 cbc
require "openssl"
require "base64"
data = "yKji5PQto8hUuj6bPcgXWQ=="
PASSWORD = '!!!!!sufficiently_long_password!!!!!';
CIPHER_METHOD = 'AES-256-CBC';
cipher = OpenSSL::Cipher.new(CIPHER_METHOD)
data=URI.decode(data)
str = Base64.urlsafe_decode64(data)
@naveed-ahmad
naveed-ahmad / weighted_random_sampling.md
Created January 16, 2017 12:25 — forked from O-I/weighted_random_sampling.md
[TIx 8] Weighted Random Sampling in Ruby

One of the many reasons I love working with Ruby is it has a rich vocabulary that allows you to accomplish your goals with a minimal amount of code. If there isn't a method that does exactly what you want, it's usually possible to build an elegant solution yourself.

Let's take the example of simulating the rolling of a die.

We can represent a die as an array of its faces.

die = [*?⚀..?⚅]
# => ["⚀", "⚁", "⚂", "⚃", "⚄", "⚅"]