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 os | |
| import sys | |
| import importlib.abc | |
| import importlib.util | |
| import json | |
| import yaml | |
| ex_registry = [] |
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
| global | |
| log /dev/log local0 | |
| log /dev/log local1 notice | |
| chroot /var/lib/haproxy | |
| stats socket /run/haproxy/admin.sock mode 660 level admin | |
| stats timeout 30s | |
| user haproxy | |
| group haproxy | |
| daemon | |
| maxconn 1024 |
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
| // | |
| // In Solidity, a mapping is like a hashmap and works with `string` like this: | |
| // mapping (string => uint) a; | |
| // | |
| // However it doesn't support accessors where string is a key: | |
| // mapping (string => uint) public a; | |
| // | |
| // "Internal compiler error: Accessors for mapping with dynamically-sized keys not yet implemented." | |
| // | |
| // An accessor returns uint when called as `a(string)`. |
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
| # Original Source: | |
| # https://gist.github.com/ggrandes/a57c401f1bad6bd0ffd87a557b7b5790 | |
| # SIGN / VERIFY | |
| openssl cms -sign -keyid -md sha256 -nodetach -binary -in /etc/passwd -signer user.crt -inkey user.key -out x.smime -outform SMIME | |
| openssl cms -verify -CAfile ca.crt -in x.smime -inform SMIME | |
| # ENCRYPT / DECRYPT | |
| openssl cms -encrypt -keyid -aes-256-cbc -in /etc/passwd -binary -out x.smime -outform SMIME user.crt | |
| openssl cms -decrypt -in x.smime -inform SMIME -recip user.crt -inkey user.key |
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
| # config to don't allow the browser to render the page inside an frame or iframe | |
| # and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking | |
| # if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri | |
| # https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options | |
| add_header X-Frame-Options SAMEORIGIN; | |
| # when serving user-supplied content, include a X-Content-Type-Options: nosniff header along with the Content-Type: header, | |
| # to disable content-type sniffing on some browsers. | |
| # https://www.owasp.org/index.php/List_of_useful_HTTP_headers | |
| # currently suppoorted in IE > 8 http://blogs.msdn.com/b/ie/archive/2008/09/02/ie8-security-part-vi-beta-2-update.aspx |
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
| JSON.parse(('{"' + $('form').serialize() + '"}').replace(/=+/gi,'":"').replace(/&+/gi,'","')); |
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 List<T> getList(long first, long last, String selectSql) throws SQLException { | |
| List<T> list = new ArrayList<T>(); | |
| String query = "select * from (select rownum rn,sq1.* from " + | |
| "("+selectSql+") sq1)" + | |
| " sq2 where sq2.rn>=" + first + " and sq2.rn<=" + last; | |
| Statement stmt = this.conn.createStatement(); | |
| ResultSet rs = stmt.executeQuery(query); | |
| while (rs.next()) | |
| list.add(convert(conn, rs)); | |
| rs.close(); |
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
| select * from | |
| ( select a.*, ROWNUM rnum from | |
| ( <your_query_goes_here, with order by> ) a | |
| where ROWNUM <= :MAX_ROW_TO_FETCH ) | |
| where rnum >= :MIN_ROW_TO_FETCH; |
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 | |
| # This script builds the iOS and Mac openSSL libraries | |
| # Download openssl http://www.openssl.org/source/ and place the tarball next to this script | |
| # Credits: | |
| # https://github.com/st3fan/ios-openssl | |
| # https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh | |
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
| <?php | |
| /** | |
| * Oracleページ制御用SQL生成クラス | |
| * | |
| * Oracle8以降(?たぶん)でPostgreSQL、MySQLでいうLIMIT、OFFSETを利用するためのPHP4用クラス。 | |
| * データベースに実際にアクセスするのではなくSQLを返す。 | |
| * このクラスの関数はOraclePagination::PageCount()のようにstaticに利用する。 | |
| * 1ページ分のレコードだけを抽出するSQL文、行数ではなく何ページあるかを返すSQLを生成する。 | |
| * | |
| * $page_numberに指定したページの行を選択する。$lines_per_pageには1ページあたりの行数を指定。 |
NewerOlder