sudo iptables -A INPUT -p tcp --dport $PORT -j ACCEPT
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
| openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem -out keystore.p12 -name tomcat; |
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
| /** | |
| * Bunch of useful filters for angularJS(with no external dependencies!) | |
| * @version v0.5.15 - 2017-01-17 * @link https://github.com/a8m/angular-filter | |
| * @author Ariel Mashraki <ariel@mashraki.co.il> | |
| * @license MIT License, http://www.opensource.org/licenses/MIT | |
| */!function(a,b,c){"use strict";function d(a){return E(a)?a:Object.keys(a).map(function(b){return a[b]})}function e(a){return null===a}function f(a,b){var d=Object.keys(a);return d.map(function(d){return b[d]!==c&&b[d]==a[d]}).indexOf(!1)==-1}function g(a,b){function c(a,b,c){for(var d=0;b+d<=a.length;){if(a.charAt(b+d)==c)return d;d++}return-1}for(var d=0,e=0;e<=b.length;e++){var f=c(a,d,b.charAt(e));if(f==-1)return!1;d+=f+1}return!0}function h(a,b,c){var d=0;return a.filter(function(a){var e=y(c)?d<b&&c(a):d<b;return d=e?d+1:d,e})}function i(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)}function j(a,b,c){b=b||[];var d=Object.keys(a);return d.forEach(function(d){if(D(a[d])&&!E(a[d])){var e=c?c+"."+d:c;j(a[d],b,e||d)}else{var f=c?c+". |
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/sh | |
| for f1 in *.wma; | |
| do | |
| f2=`echo $f1 | cut -d '.' -f 1`.mp3; | |
| avconv -i "$f1" "$f2"; | |
| 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 | |
| PATH_TO_FIND="$1" | |
| TEXT_TO_FIND="$2" | |
| find $1 -type f | | |
| while read f; do | |
| if [ $(grep $2 "$f" | wc -l) -gt 0 ]; then | |
| echo $f | |
| else | |
| if [ $(echo "$f" | grep $2 | wc -l) -gt 0 ]; then | |
| echo $f |
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
| ## Core latex/pdflatex auxiliary files: | |
| *.aux | |
| *.lof | |
| *.log | |
| *.lot | |
| *.fls | |
| *.out | |
| *.toc | |
| *.fmt |
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> | |
| int main(int argc, char** argv){ | |
| int* tmp = (int *) (argv - 1); | |
| printf("argc = %d;\n", argc); | |
| printf("memo = %d;\n", *tmp); | |
| return 0; | |
| } |
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
| DB_HOST=$1 | |
| DB_PORT=$2 | |
| DB_NAME=$3 | |
| DB_USER=$4 | |
| DB_SUPERUSER=$5 | |
| psql -h $DB_HOST -p $DB_PORT -U $DB_SUPERUSER -c "ALTER DATABASE $DB_NAME OWNER TO $DB_USER;" | |
| for i in $(psql -h $DB_HOST -p $DB_PORT -d $DB_NAME -U $DB_SUPERUSER \ | |
| -c "select tablename from pg_tables where schemaname = 'public'"); do |
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
| // From https://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format/4673436#4673436 | |
| if (!String.prototype.format) { | |
| String.prototype.format = function() { | |
| var args = arguments; | |
| return this.replace(/{(\d+)}/g, function(match, number) { | |
| return typeof args[number] != 'undefined' | |
| ? args[number] | |
| : match | |
| ; | |
| }); |
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
| def set_pos(i, p, v): | |
| return i ^ 2**p if v else i - 2**p | |
| def get_pos(i, p): | |
| pos_b = 2**(p-1) | |
| res = ((i ^ ((2**9-1) ^ pos_b)) & pos_b) | |
| return 1 if res > 0 else 0 |