Skip to content

Instantly share code, notes, and snippets.

View chris-x86-64's full-sized avatar

Christopher Smith chris-x86-64

View GitHub Profile
import sys
import random
ZUN = 'ズン'
DOKO = 'ドコ'
KIYOSHI = 'キヨシ!'
class ZunDoko(object):
def __init__(self):
self.words = list()
@chris-x86-64
chris-x86-64 / aliases
Last active April 14, 2016 04:33
Login alert system using sendmail and Slack
# Add the following line to /etc/aliases
slack: |"/usr/bin/python /path/to/post-to-slack.py"
@chris-x86-64
chris-x86-64 / login-alert.py
Created April 13, 2016 11:35
A Python script which posts login alerts to Slack webhook. (Requires 'who' command)
import socket
import commands
import urllib
import urllib2 as urlrequest
import json
from datetime import datetime
SLACK_POST_URL = "https://hooks.slack.com/services/[TOKEN]"
def build_attachment():
@chris-x86-64
chris-x86-64 / age_calc.py
Last active January 4, 2016 02:39
Age calculator available for use at http://age.x86-64.jp/ Usage: curl http://age.x86-64.jp/1991/12/29 ... Response: "Age: 22"
from flask import Flask
from datetime import date
app = Flask(__name__)
app.config.update(
DEBUG=False,
)
@app.route('/')
def usage():
#!/usr/bin/env python
wavelength = input("Input the wavelength within 0.2~0.55um in um: ")
x = 0.389*wavelength + 0.09426/wavelength -0.3228
sigma = 4.02 * 10**(-28) / wavelength**(4 + x)
lnAB = input("Input the value of lnAB : ")
N = lnAB/sigma
print "cross section sigma/cm^-2 is : ", sigma
print "density N/(number/cm^-2) is : ", N
@chris-x86-64
chris-x86-64 / dbgairon-enshuu.xml
Last active December 26, 2015 06:49
データベース概論II 演習問題 (適当なXMLを作成する)
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE people [
<!ELEMENT people (person+)>
<!ELEMENT person (name, age, birthday, address, phone?, occupation, comment?)>
<!ATTLIST person id #REQUIRED>
<!ELEMENT name (given, surname)>
<!ELEMENT given (#PCDATA)>
<!ELEMENT surname (#PCDATA)>
<!ELEMENT age (#PCDATA)>
<!ELEMENT birthday (year, month, day)>
@chris-x86-64
chris-x86-64 / progress.rb
Last active December 21, 2015 19:30
studying mikutter plugin
# -*- coding: utf-8 -*-
Plugin.create(:progress) do
filter_show_filter do |msgs|
[
msgs.map do |m|
if m and !m[:retweeted_status]
m[:message] = "進捗どうですか"
end
@chris-x86-64
chris-x86-64 / chitanda.pl
Last active December 21, 2015 15:39
千反田える
#!/usr/bin/perl
use strict;
use warnings;
use feature 'say';
my @numeric_characters = ('', '一', '二', '三', '四', '五', '六', '七', '八', '九');
my @digits = ('', '十', '百', '千');
my @alphabets = (
" Author: Keiya Chinen, keiyac
" Last Change: 2010/07/29
scriptencoding utf-8
syntax on
filetype plugin on
filetype indent on
augroup vimrc
autocmd!
augroup end
# -*- coding: utf-8 -*-
# Author: Keiya Chinen, keiyac
# lastupdate 2010/07/30
# users generic .zshrc file for zsh(1)
## Environment variable configuration
#
# LANG
#