Skip to content

Instantly share code, notes, and snippets.

View NoahDragon's full-sized avatar
I may be slow to respond.

Noah NoahDragon

I may be slow to respond.
View GitHub Profile
@NoahDragon
NoahDragon / add_disqus_hexo.md
Created April 30, 2016 00:28 — forked from ythecombinator/add_disqus_hexo.md
Simple tip for adding "Disqus" comments for Hexo.

In the footer of your theme (something like footer.ejs) you should add Disqus script:

<% if (config.disqus_shortname){ %>
<script>
  var disqus_shortname = '<%= config.disqus_shortname %>';
  <% if (page.permalink){ %>
  var disqus_url = '<%= config.url +"/"+ page.path %>';
  <% } %>
 (function(){
@NoahDragon
NoahDragon / GetServerName.sql
Created May 12, 2016 18:33
Check server name, host name, instance name, and etc. on SQL server .
SELECT HOST_NAME() AS 'host_name()',
@@servername AS 'ServerName\InstanceName',
SERVERPROPERTY('servername') AS 'ServerName',
SERVERPROPERTY('machinename') AS 'Windows_Name',
SERVERPROPERTY('ComputerNamePhysicalNetBIOS') AS 'NetBIOS_Name',
SERVERPROPERTY('instanceName') AS 'InstanceName',
SERVERPROPERTY('IsClustered') AS 'IsClustered'
@NoahDragon
NoahDragon / article.ejs
Created August 12, 2016 23:41
Work around to disable comments for Hexo yinwang theme. (Replace it with the same file under yinwang/layout/_partial/)
<% if (post && index){ %>
<li class="list-group-item title">
<a target="_blank" href="<%- url_for(post.path)%>"><%= post.title%></a>
</li>
<% } else { %>
<%- post.content %>
<% } %>
var result = [];
function isArray (value) {
return value.constructor === Array;
}
function extract (value) {
if (isArray(value)) {
@NoahDragon
NoahDragon / InstallLinuxKernelAndEnableBBR.sh
Last active April 23, 2019 05:48
Update Ubuntu Linux Kernel to 4.9 Which Includes the BBR Algorithm, It Can Significantly Improve the TCP Connection Performance. (Like ServerSpeeder)
#! /bin/sh
wget http://in4serv.com.br/backup/kernel-4.9-stable && sudo chmod +x ./kernel-4.9-stable && ./kernel-4.9-stable
# After reboot, turn on BBR
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p # Save the changes
sysctl net.ipv4.tcp_available_congestion_control # Check if BBR is turned on
lsmod | grep bbr # Check if BBR is running
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@NoahDragon
NoahDragon / little_schemer.rkt
Last active June 29, 2018 19:52
Functions in "The Little Schemer" book.
#lang scheme
(define atom?
(lambda (x)
(and (not (pair? x)) (not (null? x)))))
(define lat?
(lambda (l)
(cond
((null? l) #t)
((atom? (car l)) (lat? (cdr l)))
@NoahDragon
NoahDragon / gist:8dc832e7b4bf81573c3449450c81c7b8
Created October 31, 2020 17:04 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@NoahDragon
NoahDragon / venv_cheat_sheet.md
Created July 12, 2022 00:15 — forked from bbengfort/venv_cheat_sheet.md
My virtualenv and virtualenv wrapper cheat sheet. I alias the commands of virtualenv and virtualenv wrapper for my own development environment.

Ben's VirtualEnv Cheatsheet

This cheat sheet describes my usage/implementation of virtualenv with virtualenv wrapper and the bash foo that I added with the help of many blogs to make it all tick together in fun land.

Quick Reference

$ echo $WORKON_HOME
/Users/benjamin/.virtualenvs

$ echo $PROJECT_HOME