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 / backtrace
Created June 14, 2017 09:34
Rubinius Backtrace
$ rbx -e 'p 2.step(by: 4).next'
Use of config file .rbxrc is deprecated, use .rbxconfig.
call # Proc at core/proc.rb:20
{ } in reset # Enumerable::Enumerator::Iterator at core/enumerator.rb:472
each # Enumerable::Enumerator at core/enumerator.rb:64
each_with_block # Enumerable::Enumerator at core/enumerator.rb:74
step # Numeric(Fixnum) at core/numeric.rb:82
> # Fixnum at core/fixnum.rb:138
math_coerce # Numeric(Fixnum) at core/numeric.rb:173
coerce (method_missing) # Kernel(NilClass) at core/zed.rb:1413