Skip to content

Instantly share code, notes, and snippets.

View ichadhr's full-sized avatar
Focusing

Chad ichadhr

Focusing
View GitHub Profile
@ichadhr
ichadhr / print.html
Last active August 26, 2023 05:32
Print External Link (HTML / PDF)
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Print External Link</title>
<script type="text/javascript">
function closePrint () {
document.body.removeChild(this.__container__);
}
@ichadhr
ichadhr / download.php
Last active October 7, 2019 15:44
PHP Download
<?php
/* Function: download with resume/speed/stream options */
/*
* Parametrs: downloadFile(File Location, File Name,
* max speed, is streaming
* If streaming - movies will show as movies, images as images
* instead of download prompt
*/
function downloadFile($fileLocation, $fileName, $maxSpeed = 13, $doStream = false)
@ichadhr
ichadhr / README.md
Last active November 7, 2023 02:32
Unblock kumpulbagi

unblock kumpul bagi

Tambahkan alamat IP dan nama domain dibawah ke file hosts

@ichadhr
ichadhr / config.md
Last active February 19, 2017 19:15
Multiple CI

Setting up one codeigniter for multiple site:

example root folder: /home/myweb/public_html/

to keep it nice and tidy

/home/myweb/ci [all codeigniter files]

/home/myweb/ci/system [codeigniter system folder & sub-folder]

@ichadhr
ichadhr / clean-log.sh
Created November 10, 2016 11:16
Cleaning Log
#!/bin/bash
echo "Deleting log file"
sudo -s -- <<EOF
find /var/log -type f -regex ".*\.gz$" -delete
find /var/log -type f -regex ".*\.[0-9]$" -delete
echo "Done."
EOF
exit
@ichadhr
ichadhr / cleanup.sh
Last active November 10, 2016 11:20
Vagrant Box CleanUp
#!/bin/bash
echo "Make user as root"
sudo -s -- <<EOF
echo "Clean system cache.."
apt-get clean
apt-get autoclean
apt-get autoremove
echo "Reducing final box"
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
@ichadhr
ichadhr / Disable_Enable.md
Last active July 21, 2025 19:10
Disable/Enable Hyper-V and VT-X

If you run bcdedit with no arguments, you should see a property called hypervisorlaunchtype. This will be set to off or auto.

To disable Hyper-V in order to use VirtualBox, open a command prompt as administrator and run the command:

bcdedit /set hypervisorlaunchtype off

You’ll need to reboot, but then you’ll be all set to run VirtualBox. To turn Hyper-V back on, run:

bcdedit /set hypervisorlaunchtype auto
@ichadhr
ichadhr / Atitude.md
Created November 3, 2016 06:46
Attitude

#IF A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

#EQUALS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

#THEN K + N + O + W + L + E +D + G + E 11 + 14 + 15 + 23 + 12 + 5 + 4 + 7 + 5 = 96%

@ichadhr
ichadhr / smoothscroll.js
Created March 15, 2016 07:33
Simple smooth scroll Javascript
// Smoothscroll
function ssc_init() {
if (!document.body) return;
var e = document.body;
var t = document.documentElement;
var n = window.innerHeight;
var r = e.scrollHeight;
ssc_root = document.compatMode.indexOf("CSS") >= 0 ? t : e;
ssc_activeElement = e;
ssc_initdone = true;
@ichadhr
ichadhr / jekyll-post-thor.md
Last active April 30, 2025 07:33
Jekyll create post with command

CREATE JEKYLL POSTS FROM THE COMMAND LINE

I got tired on creating new files manually for each new post a write so I put together this little command line task with Thor.

It creates a new file in the _posts directory with today’s date, parses the parameters to command as the post’s title and adds that as a slug to the new file. It then writes a default yaml template to the file (as specified in the script).

Running thor jekyll:new New and shiny post will for example create the file _posts/2012-12-28-new-and-shiny-post.markdown, populate it with an yaml template and finally open the file in my favorite editor.

HOW TO

Add the following to your Gemfile: