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 | |
/* | |
This script can be used on terminal. Eg: | |
$ php id_date_valid.php 2019-08-12 15:23:58 | |
*/ | |
$datetime = $argv[1] . ' ' . $argv[2]; | |
if ($datetime == date('Y-m-d H:i:s', strtotime ($datetime))) { | |
echo "true"; | |
} else { |
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 | |
# perl: warning: Setting locale failed. | |
# perl: warning: Please check that your locale settings: | |
# LANGUAGE = (unset), | |
# LC_ALL = (unset), | |
# LC_CTYPE = "UTF-8", | |
# LANG = "en_US.UTF-8" | |
# are supported and installed on your system. | |
# perl: warning: Falling back to the standard locale ("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
Delete node and/or node_modules from /usr/local/lib | |
Delete node and/or node_modules from /usr/local/include | |
Delete node, node-debug, and node-gyp from /usr/local/bin | |
Delete .npmrc from your home directory (these are your npm settings, don’t delete this if you plan on re-installing Node right away) | |
Delete .npm from your home directory | |
Delete .node-gyp from your home directory | |
Delete .node_repl_history from your home directory | |
Delete node* from /usr/local/share/man/man1/ | |
Delete npm* from /usr/local/share/man/man1/ | |
Delete node.d from /usr/local/lib/dtrace/ |
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 | |
# Thanks Stephen Kitt (https://unix.stackexchange.com/a/527524/273356) | |
od -t x1 -w1 -v -An mybinaryfile | sort | uniq -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
/* | |
USE REF_CONSTRAINT IF ITS A FOREIGN KEY. | |
USE CONSTRAINT IF ITS ANOTHER TYPE OF CONSTRAINT. | |
*/ | |
SELECT DBMS_METADATA.GET_DDL('REF_CONSTRAINT', 'FK_HUMAN_PLANET') FROM dual; |
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 V$SESSION WHERE SCHEMANAME = 'MYSCHEMA' AND MACHINE = 'applicationserver.localdomain' AND STATUS = 'INACTIVE'; | |
ALTER SYSTEM KILL SESSION '87,33311'; -- SID,SERIAL | |
ALTER SYSTEM DISCONNECT SESSION '87,33311' IMMEDIATE; |
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 | |
/** | |
* generateCallTrace() function | |
* | |
* A function for getting a nice and comprehensible call trace. | |
* It is probably more resource-intensive than some other alternatives but it is short, | |
* understandable, and gives nice output (Exception->getTraceAsString()). | |
* | |
* @package generateCallTrace | |
* @version 1.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
# Use the -p flag if needed: | |
mysqldump -u root db_with_data | mysql -u root db_empty | |
# If you have the error | |
# "mysqldump: Got error: 1449: The user specified as a definer ('someuser'@'someaddress') | |
# does not exist when using LOCK TABLES", | |
# create the missing user: | |
mysql> create user 'someuser'@'someaddress'; | |
# Run the dump: |
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
/* | |
source: https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/insertRule | |
*/ | |
var styleElement = document.createElement('style'); | |
document.head.appendChild(styleElement); | |
styleSheet = styleElement.sheet; | |
styleSheet.insertRule("p, h1, h2, h3 {font-family: Courier New; color: blue;", 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
// ==UserScript== | |
// @name Phabricator Annoyance Remover | |
// @description Task view description and task edit description font is set to Courier New. The edit description height is auto adjusted to content. All comment entries that aren't true comments are removed from view. | |
// @namespace https://github.com/llagerlof/ | |
// @author 2018, Lawrence Lagerlof (https://github.com/llagerlof) | |
// @license MIT | |
// @include /https?:\/\/.*\/maniphest\/task\/edit\// | |
// @include /https?:\/\/.*\/T[0-9]+(?:#([0-9]+))?$/ | |
// @require https://cdnjs.cloudflare.com/ajax/libs/autosize.js/4.0.2/autosize.min.js | |
// @version 1.3 |