This file contains hidden or 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
| using System; | |
| class GocLapTrinh | |
| { | |
| static int NhapSoThapPhan() | |
| { | |
| Console.Write("Nhap so thap phan: "); | |
| return int.Parse(Console.ReadLine() ?? string.Empty); | |
| } |
This file contains hidden or 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
| import java.util.Scanner; | |
| public class GocLapTrinh { | |
| static int nhapSoThapPhan(Scanner scanner) { | |
| System.out.print("Nhập số thập phân: "); | |
| return scanner.nextInt(); | |
| } | |
| static String nhapSoBase32(Scanner scanner) { | |
| System.out.print("Nhập số ở hệ cơ số 32 (bảng mã Crockford Base32): "); |
This file contains hidden or 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 <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <ctype.h> | |
| int nhapSoThapPhan() { | |
| int n; | |
| printf("Nhập số thập phân: "); | |
| scanf("%d", &n); | |
| return n; |
This file contains hidden or 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 <iostream> | |
| int nhapSoThapPhan() { | |
| int n; | |
| std::cout << "Nhập số thập phân: "; | |
| std::cin >> n; | |
| return n; | |
| } | |
| std::string nhapSoBase32() { |
This file contains hidden or 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 main | |
| import ( | |
| "fmt" | |
| "os" | |
| "regexp" | |
| "strings" | |
| "github.com/btnguyen2k/oaiaux" | |
| ) |
This file contains hidden or 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 main | |
| import ( | |
| "fmt" | |
| "github.com/btnguyen2k/oaiaux" | |
| ) | |
| func CountTokens(text, lang, encoding string) { | |
| numTokens := oaiaux.CountTokens(text, oaiaux.Option{Key: "encoding", Value: encoding}) |
This file contains hidden or 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
| // EstimateTokens estimates the number of tokes for an input string. | |
| func EstimateTokens(input string) int { | |
| const re1 = `[^\w\d]+` | |
| const re2 = `[\w\d]+` | |
| reWords := regexp.MustCompile(re1) | |
| words := reWords.Split(input, -1) | |
| numWords := 0 | |
| for _, w := range words { | |
| if w != "" { | |
| numBytes := len([]byte(w)) |
This file contains hidden or 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
| --- | |
| apiVersion: rbac.authorization.k8s.io/v1 | |
| kind: ClusterRole | |
| metadata: | |
| name: kured | |
| rules: | |
| # Allow kured to read spec.unschedulable | |
| # Allow kubectl to drain/uncordon | |
| # | |
| # NB: These permissions are tightly coupled to the bundled version of kubectl; the ones below |
This file contains hidden or 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
| import java.util.*; | |
| /** | |
| * A demo Java application to see how GC works. | |
| * | |
| * @author Thanh Nguyen | |
| */ | |
| public class GcMemDemo { | |
| static Map<Long, byte[]> buffer = new HashMap<>(); |
This file contains hidden or 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 | |
| echo '==================================================' | |
| echo '===============Install necessary tools===============' | |
| echo '==================================================' | |
| sudo yum update | |
| sudo yum install git make flex bison libtool automake openssl-devel libevent libevent-devel python-devel gcc-c++ byacc java-1.7.0-openjdk ant | |
| echo '==================================================' |
NewerOlder