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
for i in $(seq -w $1 $2) | |
do | |
num=$(printf %02d $i) | |
VMID=`vim-cmd vmsvc/getallvms |grep CentOS7-$num | cut -f1 -d' '` | |
vim-cmd vmsvc/power.shutdown $VMID | |
done |
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 | |
# | |
# Username is 1111111111 | |
# Password is 2222222222 | |
# Change them to yours. | |
# | |
# | |
curl -k -e "https://login.rmutsb.ac.th/login.php" "https://login.rmutsb.ac.th/login.php" -d "_u=1111111111&_p=2222222222&a=a&web_host=login.rmutsb.ac.th&web_host4=auth4.rmutsb.ac.th&_ip4=&web_host6=auth6.rmutsb.ac.th&_ip6=" |
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
protected override void OnModelCreating(ModelBuilder modelBuilder) | |
{ | |
var mapper = new Npgsql.NpgsqlSnakeCaseNameTranslator(); | |
var types = modelBuilder.Model.GetEntityTypes().ToList(); | |
// Refer to tables in snake_case internally | |
types.ForEach(e => e.Relational().TableName = mapper.TranslateMemberName(e.Relational().TableName)); | |
// Refer to columns in snake_case internally | |
types.SelectMany(e => e.GetProperties()) |
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
version: '3.7' | |
services: | |
mariadb: | |
image: 'bitnami/mariadb:latest' | |
environment: | |
- MARIADB_USER=bn_wordpress | |
- MARIADB_DATABASE=bitnami_wordpress | |
- MARIADB_PASSWORD=bn_password | |
- ALLOW_EMPTY_PASSWORD=yes | |
volumes: |
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
1. Update Kernel to 4.20 | |
2. Install docker, docker-compose | |
3. Enable ip forwarding | |
Add net.ipv4.ip_forward=1 to /etc/sysctl.conf | |
- Restart network service | |
- Check: sysctl net.ipv4.ip_forward | |
4. Install iptables-services via yum |
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
public async Task<bool> SendNotify(string accesstoken, string Msg) | |
{ | |
try | |
{ | |
var client = new HttpClient(); | |
client.BaseAddress = new Uri("https://notify-api.line.me/api/"); | |
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accesstoken); | |
var nvc = new List<KeyValuePair<string, string>>(); | |
nvc.Add(new KeyValuePair<string, string>("message", Msg)); |
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 Microsoft.Extensions.Configuration; | |
using Microsoft.IdentityModel.Tokens; | |
using System.IdentityModel.Tokens.Jwt; | |
using System.Security.Claims; | |
using Microsoft.AspNetCore.Authorization; | |
public TokenController(IConfiguration config, ApplicationDbContext dbContext) | |
{ | |
_config = config; |
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
// appSettings.json | |
"Jwt": { | |
"Key": "secret-key", | |
"Issuer": "https://localhost:5000/" | |
} | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddDbContext<ApplicationDbContext>(options => |
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
default-lease-time 86400; # 24 hours | |
max-lease-time 172800; # 48 hours | |
subnet 192.168.13.0 netmask 255.255.255.0 { | |
option domain-name "myrmutsb.com"; | |
option domain-name-servers 8.8.8.8, 8.8.4.4; | |
option routers 192.168.13.1; | |
option subnet-mask 255.255.255.0; | |
range 192.168.13.101 192.168.13.200; | |
} |
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; | |
using System.IO; | |
using System.Net; | |
public static class FileDownloader | |
{ | |
private const string GOOGLE_DRIVE_DOMAIN = "drive.google.com"; | |
private const string GOOGLE_DRIVE_DOMAIN2 = "https://drive.google.com"; | |
// Normal example: FileDownloader.DownloadFileFromURLToPath( "http://example.com/file/download/link", @"C:\file.txt" ); |