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
#!/usr/bin/env ruby | |
# | |
# check all certificates in "./certs/" whether they are a self-signed certificate, or not. | |
# | |
require 'openssl' | |
Dir['certs/*'].each do |file| | |
#diff = `openssl x509 -in #{file} -noout -issuer -subject| cut -d'=' -f2 | uniq | wc -l` | |
#if diff.chomp == '1' | |
cert = OpenSSL::X509::Certificate.new(File.open(file)) |
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 | |
#In the file, list of usernames & passwords in format of: "user:pass" | |
file=credentiallist.txt | |
[[ $# -ne 1 ]] && echo "usage: $0 ip_or_hostname_here" && exit | |
while IFS=: read user pass | |
do | |
mysql -h $1 -u $user -p"$pass" -e STATUS && echo "Found: user=$user pass=$pass" && exit 0 | |
done < $file |
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 class LoopExample{ | |
public static void main(String[] args){ | |
/* sine */ | |
for(double y=1.0;y>=-1.0;y-=0.1){ | |
for(double x=0;x<=2*Math.PI;x+=5*Math.PI/180){ | |
if( (Math.sin(x)>=0 && y<=Math.sin(x) && y>=0) || | |
(Math.sin(x)<=0 && Math.sin(x)<=y && y<=0)) | |
System.out.print('*'); | |
else | |
System.out.print(' '); |
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 | |
for f in * | |
do | |
n=$(echo $f|iconv -f LATIN1 -t UTF8 -c) | |
mv "$f" "$n" | |
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
#!/usr/bin/env python | |
#idea from: https://rossta.net/blog/pascals-triangle-with-rubys-enumerator.html | |
row=[1] | |
print row | |
for i in xrange(10): | |
row=[ sum(x) for x in zip([0]+row, row+[0]) ] | |
print row |
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 | |
sudo apt-get update && sudo apt-get upgrade -y | |
sudo apt-get install -y libdatrie-dev libthai-dev | |
cd /tmp | |
mkdir libthai4r && curl -L https://github.com/ptantiku/libthai4r/tarball/master | tar xz --strip 1 -C libthai4r | |
cd libthai4r | |
ruby extconf.rb | |
make | |
sudo make install |
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 | |
yum -y install texlive texlive-latex texlive-xetex | |
yum -y install texlive-collection-latex | |
yum -y install texlive-collection-latexrecommended | |
yum -y install texlive-xetex-def | |
yum -y install texlive-collection-xetex | |
#Optional | |
#yum -y install texlive-collection-latexextra | |
yum -y install texlive-xltxtra |
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
\documentclass[12pt,a4paper]{article} | |
\usepackage{fontspec} | |
\usepackage{xunicode} | |
\usepackage{xltxtra} | |
\XeTeXlinebreaklocale "th" | |
\renewcommand{\baselinestretch}{1.2} | |
\defaultfontfeatures{Scale=1.23} | |
%\fontspec[Scale=1.23]{TH SarabunPSK} %scale specific font |
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: '2' | |
services: | |
web: | |
image: python:2.7 | |
volumes: | |
- $PWD/public_html:/web | |
ports: | |
- "443:443" | |
working_dir: /web | |
command: bash -c "python -m SimpleHTTPServer 443 2>&1" |
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 csv | |
from openpyxl import Workbook, load_workbook | |
infile = 'input.csv' | |
outfile = 'output.xlsx' | |
# wb = Workbook() # new file | |
wb = load_workbook( outfile ) # load existing file | |
ws = wb.active |