| git init
git add .
git commit
git remote add origin https://jbmckee@bitbucket.org/jbmckee/snaprsend.git
git push -u origin master
|
https://snipt.net/embed/a08e51b4dff275fc1d931fd7584c3799/
/raw/a08e51b4dff275fc1d931fd7584c3799/
a08e51b4dff275fc1d931fd7584c3799
text
Text only
6
2025-04-02T17:50:47
True
False
False
May 16, 2018 at 02:12 AM
/api/public/snipt/60/
existing-files-to-git
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a>
<a href="#L-2">2</a>
<a href="#L-3">3</a>
<a href="#L-4">4</a>
<a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>git init
</span><span id="L-2"><a name="L-2"></a>git add .
</span><span id="L-3"><a name="L-3"></a>git commit
</span><span id="L-4"><a name="L-4"></a>git remote add origin https://jbmckee@bitbucket.org/jbmckee/snaprsend.git
</span><span id="L-5"><a name="L-5"></a>git push -u origin master
</span></pre></div>
</td></tr></table>
git
https://snipt.net/embed/0d58fd847cc5f75beda4be8bece3798c/
/raw/0d58fd847cc5f75beda4be8bece3798c/
0d58fd847cc5f75beda4be8bece3798c
text
Text only
1
2025-04-03T15:25:53
True
False
False
May 11, 2018 at 08:36 PM
/api/public/snipt/59/
letsencrypt
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>sudo certbot --apache
</span></pre></div>
</td></tr></table>
| RewriteEngine on
RewriteRule ^ https://www.shrinkfortheshyguy.com%{REQUEST_URI} [END,NE,R=permanent]
Redirect permanent / https://agents.reviewmagnetsystem.com/
|
https://snipt.net/embed/3dd47f232da56c0971d811bd0ace1934/
/raw/3dd47f232da56c0971d811bd0ace1934/
3dd47f232da56c0971d811bd0ace1934
text
Text only
5
2025-03-29T02:30:55
True
False
False
/api/public/snipt/58/
redirect-ssl
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a>
<a href="#L-2">2</a>
<a href="#L-3">3</a>
<a href="#L-4">4</a>
<a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>RewriteEngine on
</span><span id="L-2"><a name="L-2"></a>RewriteRule ^ https://www.shrinkfortheshyguy.com%{REQUEST_URI} [END,NE,R=permanent]
</span><span id="L-3"><a name="L-3"></a>
</span><span id="L-4"><a name="L-4"></a>
</span><span id="L-5"><a name="L-5"></a>Redirect permanent / https://agents.reviewmagnetsystem.com/
</span></pre></div>
</td></tr></table>
Letsencrypt, apache, linux
https://snipt.net/embed/1e7b2d4d9b3c6b3a9a480acc5cf1af28/
/raw/1e7b2d4d9b3c6b3a9a480acc5cf1af28/
1e7b2d4d9b3c6b3a9a480acc5cf1af28
text
Text only
1
2025-03-28T21:35:36
True
False
False
May 09, 2018 at 02:01 PM
/api/public/snipt/57/
show-processlist
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>show processlist
</span></pre></div>
</td></tr></table>
| select count(*) as totalsent, sum(opened is not null) as opened, round((sum(opened is not null)/count(*))*100) openperc, sum(clicked is not null) as clicked, round((sum(clicked is not null)/sum(opened is not null))*100) clickperc
|
https://snipt.net/embed/3ec2b73c60eba7468418c6d08ad753ee/
/raw/3ec2b73c60eba7468418c6d08ad753ee/
3ec2b73c60eba7468418c6d08ad753ee
text
Text only
2
2025-04-03T15:33:54
True
False
False
Apr 20, 2018 at 01:19 PM
/api/public/snipt/56/
sum-of-not-null-values
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>select count(*) as totalsent, sum(opened is not null) as opened, round((sum(opened is not null)/count(*))*100) openperc, sum(clicked is not null) as clicked, round((sum(clicked is not null)/sum(opened is not null))*100) clickperc
</span></pre></div>
</td></tr></table>
mysql, mysqli, sql
| $pwd = str_shuffle(bin2hex(openssl_random_pseudo_bytes(4)));
OR
// usage: $newpassword = generatePassword(12); // for a 12-char password, upper/lower/numbers.
// functions that use rand() or mt_rand() are not secure according to the PHP manual.
function getRandomBytes($nbBytes = 32)
{
$bytes = openssl_random_pseudo_bytes($nbBytes, $strong);
if (false !== $bytes && true === $strong) {
return $bytes;
}
else {
throw new \Exception("Unable to generate secure token from OpenSSL.");
}
}
function generatePassword($length){
return substr(preg_replace("/[^a-zA-Z0-9]/", "", base64_encode(getRandomBytes($length+1))),0,$length);
}
|
Expand
Collapse
(20 lines)
https://snipt.net/embed/2412c32037a574e182a9dcd04fde0d3e/
/raw/2412c32037a574e182a9dcd04fde0d3e/
2412c32037a574e182a9dcd04fde0d3e
text
Text only
20
2025-04-03T15:27:12
True
False
False
Apr 13, 2018 at 05:27 PM
/api/public/snipt/55/
random-password
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1"> 1</a>
<a href="#L-2"> 2</a>
<a href="#L-3"> 3</a>
<a href="#L-4"> 4</a>
<a href="#L-5"> 5</a>
<a href="#L-6"> 6</a>
<a href="#L-7"> 7</a>
<a href="#L-8"> 8</a>
<a href="#L-9"> 9</a>
<a href="#L-10">10</a>
<a href="#L-11">11</a>
<a href="#L-12">12</a>
<a href="#L-13">13</a>
<a href="#L-14">14</a>
<a href="#L-15">15</a>
<a href="#L-16">16</a>
<a href="#L-17">17</a>
<a href="#L-18">18</a>
<a href="#L-19">19</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>$pwd = str_shuffle(bin2hex(openssl_random_pseudo_bytes(4)));
</span><span id="L-2"><a name="L-2"></a>
</span><span id="L-3"><a name="L-3"></a>OR
</span><span id="L-4"><a name="L-4"></a>
</span><span id="L-5"><a name="L-5"></a>// usage: $newpassword = generatePassword(12); // for a 12-char password, upper/lower/numbers.
</span><span id="L-6"><a name="L-6"></a>// functions that use rand() or mt_rand() are not secure according to the PHP manual.
</span><span id="L-7"><a name="L-7"></a>function getRandomBytes($nbBytes = 32)
</span><span id="L-8"><a name="L-8"></a>{
</span><span id="L-9"><a name="L-9"></a> $bytes = openssl_random_pseudo_bytes($nbBytes, $strong);
</span><span id="L-10"><a name="L-10"></a> if (false !== $bytes && true === $strong) {
</span><span id="L-11"><a name="L-11"></a> return $bytes;
</span><span id="L-12"><a name="L-12"></a> }
</span><span id="L-13"><a name="L-13"></a> else {
</span><span id="L-14"><a name="L-14"></a> throw new \Exception("Unable to generate secure token from OpenSSL.");
</span><span id="L-15"><a name="L-15"></a> }
</span><span id="L-16"><a name="L-16"></a>}
</span><span id="L-17"><a name="L-17"></a>function generatePassword($length){
</span><span id="L-18"><a name="L-18"></a> return substr(preg_replace("/[^a-zA-Z0-9]/", "", base64_encode(getRandomBytes($length+1))),0,$length);
</span><span id="L-19"><a name="L-19"></a>}
</span></pre></div>
</td></tr></table>
| <VirtualHost *:80>
DocumentRoot "/var/www/upvote/frontend/web"
ServerName example.com
ServerAlias www.example.com
<Directory "/var/www/upvote/frontend/web">
Options +FollowSymlinks +Indexes
AllowOverride All
</Directory>
</VirtualHost>
|
Expand
Collapse
(9 lines)
https://snipt.net/embed/d4504df5366dce64de3c232ddb74cf74/
/raw/d4504df5366dce64de3c232ddb74cf74/
d4504df5366dce64de3c232ddb74cf74
text
Text only
9
2025-04-03T12:10:14
True
False
False
/api/public/snipt/22/
virtual-host
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a>
<a href="#L-2">2</a>
<a href="#L-3">3</a>
<a href="#L-4">4</a>
<a href="#L-5">5</a>
<a href="#L-6">6</a>
<a href="#L-7">7</a>
<a href="#L-8">8</a>
<a href="#L-9">9</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><VirtualHost *:80>
</span><span id="L-2"><a name="L-2"></a> DocumentRoot "/var/www/upvote/frontend/web"
</span><span id="L-3"><a name="L-3"></a> ServerName example.com
</span><span id="L-4"><a name="L-4"></a> ServerAlias www.example.com
</span><span id="L-5"><a name="L-5"></a> <Directory "/var/www/upvote/frontend/web">
</span><span id="L-6"><a name="L-6"></a> Options +FollowSymlinks +Indexes
</span><span id="L-7"><a name="L-7"></a> AllowOverride All
</span><span id="L-8"><a name="L-8"></a> </Directory>
</span><span id="L-9"><a name="L-9"></a></VirtualHost>
</span></pre></div>
</td></tr></table>
apache
| 'authManager' => [
'class' => 'yii\rbac\DbManager',
],
yii migrate --migrationPath=@yii/rbac/migrations/
|
https://snipt.net/embed/c9f9e8d76f8751c931d4d25d2cbc8537/
/raw/c9f9e8d76f8751c931d4d25d2cbc8537/
c9f9e8d76f8751c931d4d25d2cbc8537
text
Text only
5
2025-04-03T15:18:20
True
False
False
Feb 03, 2018 at 05:15 PM
/api/public/snipt/21/
rbac
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a>
<a href="#L-2">2</a>
<a href="#L-3">3</a>
<a href="#L-4">4</a>
<a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>'authManager' => [
</span><span id="L-2"><a name="L-2"></a> 'class' => 'yii\rbac\DbManager',
</span><span id="L-3"><a name="L-3"></a>],
</span><span id="L-4"><a name="L-4"></a>
</span><span id="L-5"><a name="L-5"></a>yii migrate --migrationPath=@yii/rbac/migrations/
</span></pre></div>
</td></tr></table>
yii
| #content {
width: 800px;
background-color: lightgrey;
margin-left: auto;
margin-right: auto;
padding: 12px;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
|
Expand
Collapse
(12 lines)
https://snipt.net/embed/e95e559e7d9e6103180c5af26bc7c6c0/
/raw/e95e559e7d9e6103180c5af26bc7c6c0/
e95e559e7d9e6103180c5af26bc7c6c0
text
Text only
12
2025-04-03T15:52:43
True
False
False
Dec 19, 2017 at 05:53 PM
/api/public/snipt/20/
center-in-centered-div-flex-box
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1"> 1</a>
<a href="#L-2"> 2</a>
<a href="#L-3"> 3</a>
<a href="#L-4"> 4</a>
<a href="#L-5"> 5</a>
<a href="#L-6"> 6</a>
<a href="#L-7"> 7</a>
<a href="#L-8"> 8</a>
<a href="#L-9"> 9</a>
<a href="#L-10">10</a>
<a href="#L-11">11</a>
<a href="#L-12">12</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a> #content {
</span><span id="L-2"><a name="L-2"></a> width: 800px;
</span><span id="L-3"><a name="L-3"></a> background-color: lightgrey;
</span><span id="L-4"><a name="L-4"></a> margin-left: auto;
</span><span id="L-5"><a name="L-5"></a> margin-right: auto;
</span><span id="L-6"><a name="L-6"></a> padding: 12px;
</span><span id="L-7"><a name="L-7"></a> display: flex;
</span><span id="L-8"><a name="L-8"></a> flex-direction: row;
</span><span id="L-9"><a name="L-9"></a> flex-wrap: wrap;
</span><span id="L-10"><a name="L-10"></a> justify-content: center;
</span><span id="L-11"><a name="L-11"></a> align-items: center;
</span><span id="L-12"><a name="L-12"></a> }
</span></pre></div>
</td></tr></table>
css
https://snipt.net/embed/5d318b260db9f79e2849dd66843c1361/
/raw/5d318b260db9f79e2849dd66843c1361/
5d318b260db9f79e2849dd66843c1361
text
Text only
1
2025-04-03T15:40:35
True
False
False
Dec 19, 2017 at 03:11 AM
/api/public/snipt/19/
laravel-get-user-id
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>$id = \Auth::user()->id;
</span></pre></div>
</td></tr></table>
laravel