Skip to content

Instantly share code, notes, and snippets.

/*
* get_string.c
*
*
* Read a string from stdin, store it in an array,
* and print it back to the user.
*/
#include <ctype.h>
#include <stdlib.h>
#!/usr/bin/env node
// Required parameters:
// @raycast.schemaVersion 1
// @raycast.title zxy-generate notion daily titles
// @raycast.mode fullOutput
// Optional parameters:
// @raycast.icon 🤖

{__/} ( • . •) / >❤️

@X140Yu
X140Yu / gulpfile.js
Created November 8, 2019 04:07
gulp + typescript + css + autorebuild
const gulp = require("gulp");
const sourcemaps = require("gulp-sourcemaps");
const ts = require("gulp-typescript");
const tsProject = ts.createProject("tsconfig.json");
const cssInput = "src/**/*.css";
const output = "out";
function typescript(cb) {
tsProject
@X140Yu
X140Yu / script.swift
Last active July 1, 2019 09:27 — forked from lexrus/auto-run.swift
每次执行 script.swift 都会检查是否需要重新编译,最后会执行编译后的 script.swiftc。
/*/../usr/bin/true
source="$0"
compiled="$0"c
if [[ "$source" -nt "$compiled" ]]; then
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcrun swiftc -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -g "$source" -o "$compiled" || exit
fi
"$compiled"
@X140Yu
X140Yu / bookmark.js
Created May 7, 2019 08:19
open current tab(github repo) in sourcegraph
javascript: (function() {
url = 'https://sourcegraph.com/' + location.href.replace(/(^\w+:|^)\/\//, '');
window.open(url, '__blank');
})();
@X140Yu
X140Yu / version.swift
Created November 29, 2018 07:25
compare string version in Swift
struct Version {
let rawValue: String
init(_ string: String) {
self.rawValue = string
}
enum CompareResult {
case greaterThan
case equal
@X140Yu
X140Yu / hdfs_client.rb
Created July 13, 2018 08:27
use hadoop hdfs in ruby
class HDFSClient
attr_accessor :prefix_url
def initialize(prefix_url)
prefix_url.append("/") unless prefix_url.end_with?("/")
@prefix_url = prefix_url
end
def upload(file_name, file_path)
system "curl -i -L -s -X PUT -T #{file_path} \
#{@prefix_url}#{file_name}\\?op\\=CREATE"
# 需要检查的 gem 以及对应的版本
requireGems = {
'psych' => '>= 2.1',
}
# cocoapods & psych
requireGems.each do |gem_name, gem_ver_reqs|
gdep = Gem::Dependency.new(gem_name, *gem_ver_reqs)
found_gspec = gdep.matching_specs.max_by(&:version)
if found_gspec
/*
* is_palindrome.c
*
*
* Read an input from stdin, print it back to the user and
* report if it is a palindrome.
*/
#include <stdio.h>
#include <stdlib.h>