Skip to content

Instantly share code, notes, and snippets.

Hakan Ensari hakanensari

Block or report user

Report or block hakanensari

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
@hakanensari
hakanensari / delete-all-linkedin-connections.js
Last active Apr 8, 2019
Bulk delete connections in LinkedIn
View delete-all-linkedin-connections.js
// Run in console
const removeConnection = () => {
$('[data-control-name="ellipsis"]').eq(0).click();
$('[data-control-name="remove"]').click();
$('[data-control-name="confirm_removed"]').click();
setTimeout(removeConnection, 100);
};
removeConnection();
View gist:c858b8b87f441d1df69b0732b39e2d3c
### Keybase proof
I hereby claim:
* I am hakanensari on github.
* I am hakanensari (https://keybase.io/hakanensari) on keybase.
* I have a public key ASCvhfbQGv5UmxeNCofiB_qe-UcdjO6Sd-tRH_Co53OJuQo
To claim this, I am signing this object:
@hakanensari
hakanensari / _.rb
Last active Dec 21, 2017
Check key sizes in a Redis instance
View _.rb
# Instantiate or get ahold of a redis client first.
def redis.keysize(key, unit: 'MB')
pos = %w[B K M G T].index(unit[0]) || raise(ArgumentError, 'bad unit')
(debug(:object, key).match(/serializedlength:(\d+)/)[1].to_f / 2**(pos * 10)).round(1)
end
redis.keys
.reduce({}) { |memo, key| memo.merge(key => redis.keysize(key)) rescue memo }
.sort_by(&:last)
View 0912383119.json
{
"Request": {
"IsValid": "True",
"ItemLookupRequest": {
"Condition": "All",
"DeliveryMethod": "Ship",
"IdType": "ASIN",
"MerchantId": "All",
"OfferPage": "1",
"ItemId": "0912383119",
@hakanensari
hakanensari / bm.rb
Created Dec 15, 2015
The cost of binding lambdas to context in Ruby
View bm.rb
require 'benchmark'
foo = -> {}
_ = BasicObject.new
def _.bar
end
n = 4_000_000
@hakanensari
hakanensari / circle.yml
Created Nov 16, 2015 — forked from jonah-williams/circle.yml
Automating deployments to Heroku from CircleCI
View circle.yml
test:
override:
- bundle exec rspec spec
deployment:
acceptance:
branch: master
commands:
- ./script/heroku_deploy.sh <ACCEPTANCE_HEROKU_APP>:
timeout: 300
@hakanensari
hakanensari / bleh.coffee
Created Nov 10, 2014
capture screenshot from video etc.
View bleh.coffee
$capture = $ ".capture"
$capture.change (event) ->
file = @files[0]
event.preventDefault()
# Capture first frame of video
video = document.createElement("video")
video.src = URL.createObjectURL(file)
video.style.visibility = "hidden"
View mws.xml
<Notification>
<NotificationMetaData>
<NotificationType>AnyOfferChanged</NotificationType>
<PayloadVersion>1.0</PayloadVersion>
<UniqueId>14baf090-6a81-4d13-b1ad-340363d569d8</UniqueId>
<PublishTime>2014-02-23T11:35:40.497Z</PublishTime>
<SellerId>MERCHANT_ID_1</SellerId>
<MarketplaceId>A2EUQ1WTGCTBG2</MarketplaceId>
</NotificationMetaData>
<NotificationPayload>
View hash_dig.rb
class Hash
def dig(key)
each.find do |k, v|
return v if k == key
v.dig(key) if v.is_a?(Hash)
end
end
end
@hakanensari
hakanensari / promo.sh
Created Apr 29, 2014
Pomodoro & Programming, Motherfucker Mashup
View promo.sh
#!/bin/bash
for i in {1..4}
do
for ITS in start stop
do
say "$ITS programming, motherfucker."
[[ $ITS = start ]] && sleep 1500 || sleep 300
done
done
You can’t perform that action at this time.