Skip to content

Instantly share code, notes, and snippets.

@chocopie
chocopie / web-servers.md
Created October 13, 2022 17:39 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@chocopie
chocopie / namecheap SSL.md
Created August 8, 2022 06:56 — forked from Shourai/namecheap SSL.md
Letsencrypt SSL certificate with namecheap hosting

source: https://savedlog.com/uncategorized/letsencrypt-ssl-certificate-namecheap-hosting/

The “Positive SSL” certificate I bought along with my domain is invalid with any of my subdomains and cannot be used with wildcards. One annoying thing is that namecheap doesn’t offer auto installation of free let’s encrypt certificates, even though, they are saying “Namecheap is dedicated to data security and privacy for all internet users. We believe the movement to encrypt nearly all web traffic is a positive direction. As more sites embrace HTTPS and use of security products, providers of free SSL are beginning to come online.”

Let me show you what it needs to be done in order to “encrypt nearly all web traffic”.

First, not required but it’s helpful to enable ssh access, it is not enabled by default on the base hosting plans, just go an start a live chat and request ssh access.

@chocopie
chocopie / the_grid.itermcolors
Created March 26, 2022 16:26
"The Grid" synthwave inspired iTerm theme
<?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">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
@chocopie
chocopie / .htaccess
Created March 16, 2020 08:02 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@chocopie
chocopie / gist:c76704444f4f18ad9deae87544ca81fd
Last active March 2, 2020 13:38
Shortcode for showing latest post on a page (Wordpress)
function getLatestPostHomepage() {
global $post;
$args = array( 'numberposts' => 1 );
$latestposts = get_posts($args);
foreach ($latestposts as $post) {
setup_postdata($post);
echo the_title("<h2>","</h2>");
echo the_content();
}
wp_reset_postdata();
@chocopie
chocopie / gist:c33658e014a8ad0071df
Created September 18, 2014 06:53
list bullet replaced with :before, with proper indent on wrapped text
ul {
padding-left: 15px;
text-indent: -15px;
}
li {
&:before {
/* replacement bullet here */
}
}
@chocopie
chocopie / Sorted, nested Wordpress archive
Created September 18, 2013 11:07
Wordpress archives page showing all posts in reverse chronological order, sorted by year then month with nested lists.
<?php
/*
Template Name: Master Archives Page
*/
?>
<?php get_header(); ?>
<article class="archive-list">
<canvas id = "c" > </canvas>
<p>
Tear the cloth with your mouse.<br><br>
Right click and drag to cut the cloth.<br><br>
Reduce physics_accuracy if it's laggy, increase it for a better effect.
</p>
@chocopie
chocopie / High dpi device scaling fix - for responsive sites
Created January 11, 2013 02:32
the meta stuff changes the screen ratio of a device so it doesn't try to fit it all into the device screen size instead it will change it to fit a 'relative' dpi which is good because it makes your stuff fit to read, but it also stops your device zooming via @niaalist
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,user-scalable=no, scale=1, maximum-scale=1.0" />
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs with IE zoomed in */
/* - Android hdpi devices and above */
/* - Android tvdpi devices, including Google Nexus 7 */