Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View IamLizu's full-sized avatar
:octocat:

S M Mahmudul Hasan IamLizu

:octocat:
View GitHub Profile
public class Singleton {
private volatile static Singleton Instance();
private Singleton () {}
public static Singleton getInstance() {
if (Instance == null) {
synchronized (Singleton.class) {
if (Instance == null) {
public class Singleton {
// holds created instance of the singleton class
private static Singleton Instance = new Singleton();
// private constructor
private Singleton () {}
public static Singleton getInstance() {
// return the created instance on all subsequent calls
return Instance;
public static synchronized Singleton getInstance() {
// checks if instance already created
if (Instance == null) {
// if not create an instance
Instance = new Singleton();
}
// return the created instance on all subsequent calls
return Instance;
}
@IamLizu
IamLizu / singleton-c#
Last active September 29, 2019 18:41
using System;
namespace OOP.Singleton
{
class Singleton
{
// holds the singleton instance
private static Singleton Instance;
public string text;
public class main {
public static void main(String[] args) {
System.out.println("Demonstrates Singleton class. Output of the two print statement bellow will be same,");
System.out.println("because the class returned the cached instance of the second call.");
// Initializing one instance of the singleton class
Singleton one = Singleton.getInstance("One");
// Inilializing another instance of singleton class
Singleton two = Singleton.getInstance("Two");
public class Singleton {
// holds instance of the singleton class
private static Singleton Instance;
public String text;
// private constructor
private Singleton (String text) {
this.text = text;
}
@IamLizu
IamLizu / search.sh
Last active March 20, 2019 14:23
A simple shell script that search a specified directory for a term inside the files, the script has the ability to limit the results.
# Author: S M Mahmudul Hasan
# Website: https://www.iamlizu.com
# Programming Forum - https://discuss.codepractice.net
# Email: hasan@codepractice.net
# Syntax: ./search [filepath - the location of the dir] [term - the keyword you want to search] [limit - integer to limit results]
#!/bin/sh
filepath="$1" #here assigning a veriable is not necessary rather not suggested.
string="$2" # "
# Allow access if Flarum is installed in a subdirectory,
# but another .htaccess in a higher directory denies access.
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order Allow,Deny
Allow from all
</IfModule>
@IamLizu
IamLizu / WP-HTML-Compression
Created May 2, 2018 19:52 — forked from sethbergman/WP-HTML-Compression
Minify HTML for WordPress without a Plugin - Add to function.php
<?php
class WP_HTML_Compression
{
// Settings
protected $compress_css = true;
protected $compress_js = true;
protected $info_comment = true;
protected $remove_comments = true;
// Variables

How to download your Udemy course videos using youtube-dl

$ youtube-dl --list-extractors | grep udemy

Steps

  1. Get link to the course to download. e.g. https://www.udemy.com/course-name/
  2. Login into udemy website, save the cookie from chrome using Chrome (Cookie.txt)[1] export extension. Save it to file udemy-cookies.txt
  3. Get the link of the video that you want to download. usually in format. Use the command provided below where you have to replace the {course_link} and {path_to_cookies_file} with respective paths.
$ youtube-dl {course_link} --cookies {path_to_cookies_file}