Skip to content

Instantly share code, notes, and snippets.

View jabedhasan21's full-sized avatar
🎯
Focusing

Jabed Bangali jabedhasan21

🎯
Focusing
View GitHub Profile
@jabedhasan21
jabedhasan21 / postgres.md
Created July 27, 2022 12:26 — forked from phortuin/postgres.md
Set up postgres + database on MacOS (M1)

Based on this blogpost.

Install with Homebrew:

$ brew install postgresql

Run server:

@jabedhasan21
jabedhasan21 / yaroslavskiy-sort.java
Created April 17, 2022 05:39 — forked from listochkin/yaroslavskiy-sort.java
Yaroslavsky Sort: 2-pivot quicksort + Insertion sort for smaller chunks
// See original announcement at http://permalink.gmane.org/gmane.comp.java.openjdk.core-libs.devel/2628
/**
* <at> author Vladimir Yaroslavskiy
* <at> version 2009.09.10 m765
*/
public class DualPivotQuicksort {
public static void sort(int[] a) {
sort(a, 0, a.length);
@jabedhasan21
jabedhasan21 / gist:4549957a080223e1f850b7b73970f4f0
Created April 1, 2019 19:12 — forked from solenoid/gist:1372386
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};
@jabedhasan21
jabedhasan21 / Example.kt
Created March 14, 2019 01:17 — forked from radoyankov/Example.kt
Easy Spannable on Kotlin
val spanned = spannable{ bold("some") + italic(" formatted") + color(Color.RED, " text") }
val nested = spannable{ bold(italic("nested ")) + url("www.google.com", "text") }
val noWrapping = bold("no ") + sub("wrapping ) + sup("also ") + "works"
text_view.text = spanned + nested + noWrapping
@jabedhasan21
jabedhasan21 / install-wkhtmltopdf-travis.md
Created June 12, 2018 09:07 — forked from hacksalot/install-wkhtmltopdf-travis.md
Install wkhtmltopdf on Ubuntu 16.04 LTS

Install the [latest wkhtmltopdf binary][1], extract it, and copy the wkhtmltopdf and wkhtmltoimage executables to /usr/bin/.

wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xf  wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
cd ./wkhtmltox/bin/
sudo cp -R ./* /usr/bin/
wkhtmltopdf -V
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@jabedhasan21
jabedhasan21 / stdc++.h
Created November 23, 2017 12:21 — forked from velicast/stdc++.h
Linux GCC 4.8.0 /bits/stdc++.h header definition.
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// 4: template strings - String.raw
// To do: make all tests pass, leave the asserts unchanged!
describe('on tagged template strings you can use the `raw` property like so `s.raw`', function() {
it('the `raw` property accesses the string as it was entered', function() {
function firstChar(strings) {
return strings.raw;
}
assert.equal(firstChar`\n`, '\\n');

Keybase proof

I hereby claim:

  • I am jabedhasan21 on github.
  • I am jabedhasan21 (https://keybase.io/jabedhasan21) on keybase.
  • I have a public key ASDnTxsDWBNCrNHD9W9EWwrKUMNNZ2GcfDXIDViLGAMRDwo

To claim this, I am signing this object: