Skip to content

Instantly share code, notes, and snippets.

@davertron
davertron / editor.html
Last active March 9, 2016 05:09 — forked from minikomi/editor.html
Javascript editor in your browser
data:text/html,
<style type="text/css">
#e {
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
font-size:16px;
}
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
# coding=UTF-8
import nltk
from nltk.corpus import brown
# This is a fast and simple noun phrase extractor (based on NLTK)
# Feel free to use it, just keep a link back to this post
# http://thetokenizer.com/2013/05/09/efficient-way-to-extract-the-main-topics-of-a-sentence/
# Create by Shlomi Babluki
# May, 2013
@leommoore
leommoore / linux_basic_security.md
Last active December 17, 2015 23:38
Linux - Basic Security

#Linux - Basic Security

##Restricting Remote IP Addresses

It is always a good idea to restrict the access to users and hosts that you trust. To do this you need to:

Edit the /etc/hosts.deny and create a rule

sshd: ALL

@zero-is-one
zero-is-one / Chinese Learning Word Order
Last active August 15, 2024 22:30
I didn't like the word order that most Chinese learning courses use. This list is the most common used chinese words/phrases and orders them so that no word is shown before its components are shown. It also includes the php files that I used to help generate this list for my own reference.
是 | [shì] to be, 是不是? shìbushì? is (it) or is (it) not?; 是否 shìfǒu whether or not, is (it) or is (it) not?
不 | [bù] not [bú] (used before tone #4); 不是 bú shì isn't
了 | [le] <verb particle marking a new situation or a completed action>; 你来了! Nǐ láile! You have come!; 我累了! Wǒ lèile! I've gotten tired!; 那好了! Nà hǎole! That's OK (now)!; 我只请了一位客人. Wǒ zhǐ qǐngle yí wèi kèren. I invited only one guest. [liǎo] end, finish, settle, dispose of, know clearly, to be able, (=了解 liǎojiě) understand, comprehend; 了了 liǎoliaǒ clearly understand, settle (a debt/etc.), to be intelligent; 了了 liǎole to be over/ended/finnish/settled; 你卖不了! Nǐ mài bùliǎo! You will not be able to sell (it)! [liào] (=瞭 liaò) to survey/watch{Compare with 子 zǐ child}
人 | [rén] person; 人类 rénlèi humankind; 有人吗? yǒu rén ma? Is there anybody here?{Compare with 入 rù enter}
我 | [wǒ] I, me, my; 我们 wǒmen we, us{Compare with 找 zhǎo seek}
在 | [zài] at; 现在 xiànzài now; 存在 cúnzài exist
有 | [yǒu] have, there is; 没有 méiyǒu haven't, there isn't;
@leommoore
leommoore / node_running_in_production.md
Last active November 21, 2021 00:50
Node - Running in Production

#Node - Running in Production This gist is based on the excellent post by @hacksparrow which is found at http://www.hacksparrow.com/running-express-js-in-production-mode.html. The main principle is that you want the application to detect that it is running on a production server and to use the production configuration. The way to do this is to set the NODE_ENV=production. To do this you need to do the following:

$ export NODE_ENV=production

But we have a little problem here. The NODE_ENV environment variable will be lost if the server restarts, so it is safer to put it in the .bash_profile file. That way the variable will set again every time the system reboots. You will find the file in your home directory. It's a hidden file, so you can't see it unless you do a ls -la. We will append the export command to the .bash_profile file.

@leommoore
leommoore / linux_production_server_setup.md
Last active June 9, 2025 07:28
Linux - Production Server Setup

#Linux - Production Server Setup The principle of running a server in production is to run only what is needed. This keeps the server load to a minimum and reduces the security footprint.

See also http://plusbryan.com/my-first-5-minutes-on-a-server-or-essential-security-for-linux-servers

##Setup the Domain Name (DNS) Point the dns address at the ip address of your server. If the server is rented you should already have a static ip address. If the machine is on your local network you may have to sudo nano /etc/network/interfaces to edit the ip address file. Your setup should be like:

iface eth0 inet static
@leommoore
leommoore / linux_cron_basics.md
Last active December 1, 2019 00:12
Linux - Cron Basics

#Linux - Cron Basics

Cron is a linux scheduling service which is used primarly on servers. It works by waking up each minute and checking its configuration files (known as crontabs) to see if there is anything to run. Cron is normally started at boot time.

###Typical uses:

  • Rotating log files
  • Summarising log files (ie Logwatch and Webalizer)
  • Autochecking for Distro updates
  • Performing Backups
@leommoore
leommoore / dns_basics.md
Last active January 30, 2021 03:34
DNS Basics

#DNS Basics Domain names are a core feature of the internet. It is simply a mechanism to give a friendly name to remove the need to use ip addresses directly. It also has a number of advantages, such as:

  1. It allows you to have more than one domain name pointing at the same ip address (ie same website).
  2. It allows you to host more than one website on a specific ip address (ie shared hosting, the website shown in the one associated with the domain name)
Record Type
@leommoore
leommoore / linux_running_a_node_service_pm2.md
Last active March 23, 2019 11:29
Linux - Running a Node Service (PM2)