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/python | |
import subprocess | |
import os | |
import sys | |
#res = subprocess.Popen(['ls','-al','/ahome'],stdout=subprocess.PIPE,stderr=subprocess.PIPE); | |
#output,error = res.communicate() | |
#if res.returncode: | |
# #raise Exception(error) |
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
package Bio; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.OutputStreamWriter; | |
import java.net.HttpURLConnection; | |
import java.net.URI; | |
import java.net.URL; | |
import java.util.Hashtable; |
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
package com.ck.server; | |
import io.netty.bootstrap.ServerBootstrap; | |
import io.netty.channel.ChannelFuture; | |
import io.netty.channel.ChannelInitializer; | |
import io.netty.channel.ChannelOption; | |
import io.netty.channel.EventLoopGroup; | |
import io.netty.channel.FixedRecvByteBufAllocator; | |
import io.netty.channel.nio.NioEventLoopGroup; | |
import io.netty.channel.socket.SocketChannel; |
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
#include <zlib.h> | |
#include <time.h> | |
#include <stdio.h> | |
#include <stdbool.h> | |
#include <sys/uio.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#include <inttypes.h> | |
#include "kseq.h" | |
#include "kstring.h" |
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 perl | |
use Mojolicious::Lite; | |
get '/' => sub { | |
my $self = shift; | |
$self->render('clock'); | |
}; | |
get '/pic' => sub { | |
my $self = shift; |
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
library(ggplot2) | |
library(scales) | |
library(ggpubr) | |
k = read.csv('iostat.tsv') | |
k$datetime <- as.POSIXct(k$time, origin="1970-01-01", tz="GMT") | |
s1 <- ggplot(k, aes(datetime)) + | |
geom_line(aes(y = rs, colour="rs"), alpha=0.4, size=1) + | |
geom_line(aes(y = ws, colour="ws"), alpha=0.4, size=1) + |
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 Solution { | |
public: | |
int trailingZeroes(int n) { | |
if (n < 5) return 0; | |
int count = 0; | |
while(n >= 5) { | |
count += floor(n/5); | |
n /= 5; | |
} | |
return count; |
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
vector<vector<int> > C(s1.length() + 1, vector<int>(s2.length() + 1, 0)); | |
// initial | |
for (int i = 1; i < s2.length() + 1; ++i) { | |
C[0][i] = C[0][i - 1] + s2[i - 1]; | |
} | |
for (int i = 1; i < s1.length() + 1; ++i) { | |
C[i][0] = C[i - 1][0] + s1[i - 1]; | |
} | |
for (int i = 1; i < s1.length() + 1; ++i) { | |
for (int j = 1; j < s2.length() + 1; ++j) { |
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 Solution { | |
public: | |
int numberOfArithmeticSlices(vector<int>& A) { | |
int count = 0; | |
int added = 0; | |
int n = A.size(); | |
for(int i = 2; i < n; i++) { | |
if (A[i-1] - A[i] == A[i-2] - A[i-1]) { | |
count += ++added; | |
} else { |
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 Solution { | |
public: | |
int reverse(int x) { | |
int rev = 0; | |
while (x != 0) { | |
int pop = x % 10; | |
x /= 10; | |
if (rev > INT_MAX/10 || rev == INT_MAX/10 && pop > 7) return 0; | |
if (rev < INT_MIN/10 || rev == INT_MIN/10 && pop < -8) return 0; | |
rev = rev * 10 + pop; |
NewerOlder