This file contains 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
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md | |
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192 | |
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB. | |
------------ | |
-- Basics -- | |
------------ | |
-- Get indexes of tables (postgres tables excluded) |
This file contains 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
function isVideoDark(videoEl) { | |
var fuzzy = 0.1; | |
// create canvas | |
var canvas = document.createElement("canvas"); | |
var videoWidth = videoEl.videoWidth; | |
var videoHeight = videoEl.videoHeight; | |
canvas.width = videoWidth; | |
canvas.height = videoHeight; | |
var ctx = canvas.getContext("2d"); |
This file contains 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: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/ | |
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]` | |
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file. | |
Now let’s extract the certificate: | |
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]` |
This file contains 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
const Textbox = (props) => { | |
return ( | |
<input value={props.estimation} onKeyDown={props.keyDownHandler} onChange={props.changeHandler}/> | |
) | |
} | |
const Result = (props) => { | |
return ( | |
<span style={{fontSize:14}}>#{props.order}. {props.estimation} {props.result}</span> | |
) |
This file contains 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
/* | |
The following code extends String class so that you can use convertToDate on a string object. | |
format can be a combination of "yy" or "yyyy" for year, "mm" for month and "dd" for day. | |
format is case-insensitive. | |
The seperator between date part markers may be "/", "." or "-". | |
Some examples: | |
"2016-12-31".convertToDate("yy-mm-dd") (same as "2016-12-31".convertToDate("yyyy-mm-dd")) | |
"31.12.2016".convertToDate("dd.MM.yyyy") | |
"12/31/2016".convertToDate("MM/dd/yyyy") | |
*/ |
This file contains 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
-- kaynak: http://stackoverflow.com/questions/15896564/get-table-and-index-storage-size-in-sql-server | |
SELECT | |
s.Name AS SchemaName, | |
t.NAME AS TableName, | |
p.rows AS RowCounts, | |
SUM(a.total_pages) * 8 AS TotalSpaceKB, | |
SUM(a.used_pages) * 8 AS UsedSpaceKB, | |
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB | |
FROM | |
sys.tables t |
This file contains 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
/* | |
Bir Kelimenin Bir Karakter Dizgisi İçindeki Tekrarlanma Sıklığını Bulma | |
*/ | |
DECLARE @wordToFind varchar(3) = 'Hello' | |
DECLARE @text varchar(300) = 'Hello World! Hello World! Hello World!' | |
SELECT (LEN(@text) - LEN(REPLACE(@text, @wordToFind, ''))) / LEN(@wordToFind) AS Tekrar |
This file contains 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
/* | |
MS SQL Server'da hangi veritabanının ne kadar yer tuttuğunu gösteren aşağıdaki SQL'in çalışma süresi, | |
veritabanı büyüklüğüyle doğru orantılıdır. Birkaç dakika sürebilir. | |
*/ | |
SELECT CAST(COUNT(1) * 8 / 1024.0 AS NUMERIC(10, 2)) AS CachedDataMB, | |
CASE database_id WHEN 32767 THEN '* Resource DB' ELSE DB_NAME(database_id) END AS DatabaseName, database_id DatabaseID | |
FROM sys.dm_os_buffer_descriptors | |
GROUP BY DB_NAME(database_id) , database_id ORDER BY DB_NAME(database_id) |
This file contains 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
-- T-SQL ile Virgüllü Liste Ayrıştırma ve Oluşturma -- | |
-- Örneklerde kullanmak üzere id alanında oluşan bir @idTable oluşturulur. | |
declare @idTable TABLE (id int) | |
insert @idTable (id) values (1) | |
insert @idTable (id) values (2) | |
/* | |
1. Virgüllü Listeye Çevirme | |
Users tablosundaki ilk 10 UserId değerini virgüllü liste haline getirme |
This file contains 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
-- Adları, Ad Soyad olarak ayırma | |
select left(FirstName, len(FirstName)-charindex(' ',reverse(FirstName))) as FirstName, right(FirstName, charindex(' ',reverse(FirstName))-1) as LastName from Users | |
-- Ad alanındaki ad/soyad verisiyle, ad ve soyad alanlarını güncelleme | |
update Users set FirstName = left(FirstName, len(FirstName)-charindex(' ',reverse(FirstName))), LastName = right(FirstName, charindex(' ',reverse(FirstName))-1) |