0x1f8972432b6e8ac7125be0bbfbddc22a7a35f8f3bcdff01407c36a15c986ab51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require 'optparse' | |
require 'ostruct' | |
require 'net/http' | |
require 'json' | |
require 'pathname' | |
options = OpenStruct.new( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(box_syntax)] | |
#![feature(box_into_raw_non_null)] | |
#![feature(nll)] | |
use std::collections::HashMap; | |
use std::hash::Hash; | |
use std::ptr::NonNull; | |
use std::cell::RefCell; | |
#[derive(Debug)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate num_iter; | |
use num_iter::range_step; | |
pub fn sieve(n: u64) -> Vec<u64> { | |
let mut prime_identifers: Vec<bool> = vec![true; n as usize + 1]; | |
let primes: Vec<u64> = vec![]; | |
for i in 2..(n as f64).sqrt() as usize + 1 { | |
if *prime_identifers.get(i).unwrap() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let video_file_regex = Regex::new(r"https://.*\.ts").unwrap(); | |
let mut result_video_file = File::create("result.ts")?; | |
let futures: Vec<_> = video_file_regex.find_iter(&hd_playlist_content).map(|capture| { | |
let video_file_link = capture.as_str(); | |
let response = client.get(video_file_link.parse().unwrap()); | |
response.unwrap().body().concat2() | |
}).collect(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" vim: set sw=2 ft=vim ts=2 sts=2 et: | |
""""""""""""""""""""""""""""""" | |
" => BUNDLES | |
""""""""""""""""""""""""""""""" | |
call plug#begin('~/.vim/plugged') | |
Plug 'MarcWeber/vim-addon-mw-utils' | |
Plug 'tomtom/tlib_vim' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assets compilation | |
FROM aparedes/alpine-node-yarn as node | |
## Node modules | |
COPY ./deps /tmp/deps | |
COPY ./assets/package.json /tmp/deps | |
COPY ./assets/package-lock.json /tmp/deps | |
WORKDIR /tmp/deps | |
RUN yarn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# shamelessly stolen from https://github.com/mat/dotfiles/blob/master/bin/curlt | |
# | |
# curl wrapper returning timing information. | |
# | |
# curl format adapted from | |
# http://josephscott.org/archives/2011/10/timing-details-with-curl/ | |
# | |
# Example usage: | |
# $ curlt http://www.apple.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyLogger < Logger | |
def add(severity, message = nil, progname = nil) | |
severity ||= UNKNOWN | |
if @logdev.nil? or severity < @level | |
return true | |
end | |
if progname.nil? | |
progname = @progname | |
end | |
if message.nil? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate libc; | |
use std::ffi::CStr; | |
use libc::c_char; | |
pub extern fn to_owned(buf: *const c_char) -> String { | |
let c_str: &CStr = unsafe { CStr::from_ptr(buf) }; | |
let buf: &[u8] = c_str.to_bytes(); | |
let str_slice: &str = std::str::from_utf8(buf).unwrap(); | |
str_slice.to_owned() |
NewerOlder