Skip to content

Instantly share code, notes, and snippets.

@rust-play
rust-play / playground.rs
Created Mar 19, 2019
Code shared from the Rust Playground
View playground.rs
fn main() {}
fn inner(i: usize) -> &'static u32 {
let z = [1, 2, 3];
&z[i]
}
@drjennym
drjennym / PY0101EN-2-4-Sets.ipynb
Created Mar 19, 2019
Created on Cognitive Class Labs
View PY0101EN-2-4-Sets.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View prod.lighthouse.report.json
{
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/72.0.3626.121 Safari/537.36",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3559.0 Mobile Safari/537.36",
"hostUserAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/72.0.3626.121 Safari/537.36",
"benchmarkIndex": 223
},
"lighthouseVersion": "4.1.0",
"fetchTime": "2019-03-19T17:28:24.608Z",
"requestedUrl": "https://smash.gg/",
View index.js
// currying function
// function TripleAdd(num1) {
// return function secondAdd(num2) {
// return function thirdAdd(num3) {
// return num1 + num2 + num3;
// }
// }
// }
// TripleAdd(1)(2)(3);
View atm.js
var moneyTypes = [5000, 1000, 500, 100, 50, 30]
var lims = {
5000: 4,
1000: 5,
500: 2,
100: 5,
50: 100,
30: 23
}
@SQLvariant
SQLvariant / Get-History2.ps1
Created Mar 19, 2019
Simple function to give you the duration of all command history in PowerShell
View Get-History2.ps1
function Get-History2
{
Get-History |
SELECT Id, @{Label="TotalRunningTime";Expression={$_.EndExecutionTime - $_.StartExecutionTime}}, CommandLine, ExecutionStatus, StartExecutionTime, EndExecutionTime
}
View gist:eed5d484818f469e62a724576f8d719f
zimbra@zim:~/boby$ cat zim_simplecloud_co_za.crt zim_simplecloud_co_za.ca-bundle > chain.crt
zimbra@zim:~/boby$ /opt/zimbra/bin/zmcertmgr verifycrt comm /opt/zimbra/ssl/zimbra/commercial/commercial.key /opt/zimbra/boby/zim_simplecloud_co_za.crt /opt/zimbra/boby/chain.crt
** Verifying '/opt/zimbra/boby/zim_simplecloud_co_za.crt' against '/opt/zimbra/ssl/zimbra/commercial/commercial.key'
Certificate '/opt/zimbra/boby/zim_simplecloud_co_za.crt' and private key '/opt/zimbra/ssl/zimbra/commercial/commercial.key' match.
** Verifying '/opt/zimbra/boby/zim_simplecloud_co_za.crt' against '/opt/zimbra/boby/chain.crt'
ERROR: Unable to validate certificate chain: /opt/zimbra/boby/zim_simplecloud_co_za.crt: C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
error 2 at 2 depth lookup:unable to get issuer certificate
zimbra@zim:~/boby$
@BrittonWinterrose
BrittonWinterrose / aws_sagemaker_lifecycle_config.txt
Created Mar 19, 2019
AWS Sagemaker Lifecycle Configuration Script.
View aws_sagemaker_lifecycle_config.txt
#!/bin/bash
set -e
/home/ec2-user/anaconda3/bin/conda config --append channels conda-forge
/home/ec2-user/anaconda3/bin/conda update --name python3 --all -q -y
/home/ec2-user/anaconda3/bin/conda install -n python3 pandas numpy matplotlib feather-format psycopg2 sqlalchemy sqlite postgresql airflow-with-postgres dask distributed tqdm textblob line_profiler seaborn bokeh scikit-learn -q -y
@micdenny
micdenny / BusExtensions.cs
Last active Mar 19, 2019
EasyNetQ BusExtensions ConnectionAwaiter
View BusExtensions.cs
public static class BusExtensions
{
public static Task ConnectionAwaiter(this IBus bus)
{
var cts = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
bus.Advanced.Connected += (s, e) =>
{
cts.TrySetResult(true);
};
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.