Skip to content

Instantly share code, notes, and snippets.

@NightFeather
NightFeather / endterm
Last active August 29, 2015 14:13
自己改學號
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ID "4102042042"
#define INPUT ID ## "_data.txt"
#define OUTPUT ID ## "_final.txt"
int main() {
FILE* fp = NULL;
require 'net/http'
Signal.trap("INT") {
puts "Caught Signal...., Go down."
exit
}
puts "Start Working at #{Dir.pwd}"
class Response < Struct.new(:path,:status, :head, :body)
class Brainfuck
class CircularArray < Array
def _pos_seek pos
if pos >= self.size
return pos - self.size
elsif pos < 0
return pos + self.size
else
return pos
#!/usr/bin/env ruby
require 'readline'
class AID
attr_reader :u, :c, :fn
def initialize item
case item
when Fixnum
self.u = item
#!/usr/bin/env ruby
# encoding: utf-8
require "net/http"
require "resolv"
require 'pp'
def D obj
p obj if ENV['DEBUG']
end
require 'net/https'
require 'nokogiri'
require 'json'
class Pixiv
Host = "www.pixiv.net"
Login = URI("https://accounts.pixiv.net/login")
IllustBase = "http://www.pixiv.net/member_illust.php?mode=medium&illust_id="
CookieFilter = /((?:PHPSESSID|device_token|p_ab_id)=.+?);/
(function(w,d){
function find_matches(el, regex) { // only find matches in TextNode
var nodes = $.grep(el.childNodes, item => item.nodeType === 3)
return [].concat.apply([], $.map(nodes, node => node.textContent.match(regex))).filter(n => n)
}
function replace_word_with_link(el, word, url) {
url = url || word
var link = "<a href=\"" + url + "\" target=\"_blank\">"+ word +"</a>"
require "nokogiri"
require "net/https"
require "json"
require "pry"
uri = URI("http://www.animen.com.tw/NewsArea/NewsItemDetail?NewsId=19811&categoryId=800&realCategoryId=1&subCategoryId=5")
dom = Nokogiri.parse Net::HTTP.get(uri)
table = dom.css(".html-raw div > table > tbody").first
@NightFeather
NightFeather / readme.md
Last active May 19, 2017 19:35
script that pulls vscode, check if newer than local, then overwrite the existing installation

What does this do?

this pulls tarball of vscode (Insider version), check if newer than local, then overwrite the existing installation

How to use?

  1. mkdir -p <where you want ot install>/bin
  2. cd into the bin dir
  3. wget https://gist.github.com/NightFeather/2395b7aba732675a1267f6f7f94de3b0/raw/update-vscode
  4. chmod +x update-vscode
  5. ./update-vscode and wait
@NightFeather
NightFeather / game_of_life.rb
Created June 28, 2017 17:26
Conway's Game of Life
require 'io/console'
class GameOfLife
def initialize size = nil, x: 20, y: 30
x,y = size, size if size
@xsize, @ysize = x, y
@playground = Array.new(y) { Array.new(x, false) }
end
def run gen = false