Skip to content

Instantly share code, notes, and snippets.

View srebalaji's full-sized avatar
🎯
Focusing

Srebalaji Thirumalai srebalaji

🎯
Focusing
View GitHub Profile
@brunolemos
brunolemos / linkedin-unfollow-everyone.js
Last active February 3, 2024 05:47
Unfollow everyone on Linkedin
(() => {
let count = 0;
function getAllButtons() {
return document.querySelectorAll('button.is-following') || [];
}
async function unfollowAll() {
const buttons = getAllButtons();
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@vraravam
vraravam / .aliases
Last active April 18, 2024 09:17
~/.aliases
#!/usr/bin/env zsh
# vim:syntax=zsh
# vim:filetype=zsh
# file location: ${HOME}/.aliases
# Add flags to existing aliases.
alias less="${aliases[less]:-less} -RF"
alias ls="${aliases[ls]:-ls} -G"
@aashish
aashish / insert_image_on_pdf.rb
Last active February 21, 2024 17:18
Insert image on a existing PDF having content with hexapdf gem
require 'hexapdf'
doc = HexaPDF::Document.open("/home/xxxx/Downloads/OoPdfFormExample.pdf")
page = doc.pages[0]
canvas = page.canvas(type: :overlay)
canvas.translate(0, 20) do
canvas.fill_color(0.3, 0.7, 0.7)
canvas.rectangle(50, 0, 80, 80, radius: 80)
@baditaflorin
baditaflorin / medium_top_1000_tags.csv
Created June 4, 2017 11:14
This is based on a scrapping project that i did, where i downloaded the list with all of the posts from medium.com https://medium.com/@baditaflorin
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 7 columns, instead of 4. in line 8.
"tag_name","count_tag_name","avg_reading_time","avg_recommends","avg_image_count","distinct_users","avg_post_data"
"Startup","134323","2.71552486545965","13.9311510314689219","1.7488739828622053","61152","2016-04-14 18:21:12.174416+03"
"Life","104197","1.78386182016248","9.0952714569517357","0.96809888960334750521","50767","2016-05-15 04:42:14.355121+03"
"Politics","99301","3.14315696061383","7.8097400831814383","1.2824543559480771","44825","2016-06-28 05:55:29.552608+03"
"Entrepreneurship","94911","2.79053337648529","14.2673241247063038","1.5481977852935908","43454","2016-04-19 22:28:35.956523+03"
"Life Lessons","94414","2.40382926434131","13.9626114771114453","1.1250450145105599","45045","2016-06-02 19:01:39.876276+03"
"Travel","80332","2.97209768940031","3.3994672110740427","4.3289224717422696","35644","2016-04-19 07:09:28.578+03"
"Design","75555","2.80802184122601","24.1416848653298921","3.5368142412811859","36471","2016-04-08 01:06:35.247556+03"
"Education","68855","2.74605567601954","6.1865369254229903"
@thomas-maschler
thomas-maschler / pg_remove_locks.sql
Created March 17, 2017 20:37
Remove locks from Postgres tables
SELECT t.schemaname,
t.relname,
l.locktype,
l.page,
l.virtualtransaction,
l.pid,
l.mode,
l.granted
FROM pg_locks l
JOIN pg_stat_all_tables t ON l.relation = t.relid
@wbotelhos
wbotelhos / libreadline_6_not_found.sh
Created November 29, 2016 20:42
Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib
@chrisveness
chrisveness / mongodb-objectid.js
Created September 14, 2016 11:32
Generates a MongoDB-style ObjectId in Node.js
/**
* Generates a MongoDB-style ObjectId in Node.js. Uses nanosecond timestamp in place of counter;
* should be impossible for same process to generate multiple objectId in same nanosecond? (clock
* drift can result in an *extremely* remote possibility of id conflicts).
*
* @returns {string} Id in same format as MongoDB ObjectId.
*/
function objectId() {
const os = require('os');
const crypto = require('crypto');
@brunogaspar
brunogaspar / README.md
Last active October 7, 2022 09:08
Install wkhtmltopdf on Ubuntu (14.04 64-bit) or (16.04 64-bit)

Install wkhtmltopdf on Ubuntu

This was tested on:

  • Ubuntu 14.04 x64
  • Ubuntu 16.04 x64

Installation

@janko
janko / 1-activerecord.rb
Last active June 13, 2023 20:00
INSERTing 50,000 records into a database in ActiveRecord, Arel, SQL, activerecord-import and Sequel.
require "active_record"
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
ActiveRecord::Migration.class_eval do
create_table(:records) do |t|
t.string :column
end
end
data = 50_000.times.map { |i| Hash[column: "Column #{i}"] }