Skip to content

Instantly share code, notes, and snippets.


Ido Shamun idoshamun

View GitHub Profile
Mando75 / PaginationHelper.ts
Last active Mar 7, 2020
An example PaginationHelper for typeorm graphql loader
View PaginationHelper.ts
import { FieldNode, GraphQLResolveInfo, SelectionNode } from "graphql";
import { GraphQLDatabaseLoader } from "@mando75/typeorm-graphql-loader";
import { SearchOptions, FeedNodeInfo } from "@mando75/typeorm-graphql-loader/dist/types";
import { LoaderSearchMethod } from "@mando75/typeorm-graphql-loader/dist/base";
import { OrderByCondition } from "typeorm";
type getFeedOptions = {
search?: SearchOptions;
order?: OrderByCondition;
whizzzkid / XPS-15 9560 Getting Nvidia To Work on KDE Neon
Last active Aug 5, 2020
[XPS 15 Early 2017 9560 kabylake] Making Nvidia Drivers + (CUDA 8 / CUDA 9 / CUDA 9.1) + Bumblebee work together on linux ( Ubuntu / KDE Neon / Linux Mint / debian )
View XPS-15 9560 Getting Nvidia To Work on KDE Neon
# Instructions for 4.14 and cuda 9.1
# If upgrading from 4.13 and cuda 9.0
$ sudo apt-get purge --auto-remove libcud*
$ sudo apt-get purge --auto-remove cuda*
$ sudo apt-get purge --auto-remove nvidia*
# also remove the container directory direcotory at /usr/local/cuda-9.0/
# Important libs required with 4.14.x with Cuda 9.X
$ sudo apt install libelf1 libelf-dev
jaynzr / cloudsql_proxy.service
Last active Feb 5, 2018
CloudSQL Proxy systemd /etc/systemd/system/cloudsql_proxy.service /etc/systemd/system/cloudsql_proxy.service.d/settings.conf
View cloudsql_proxy.service
Description=CloudSQL Proxy
ExecStart=/usr/local/bin/cloud_sql_proxy -dir=/cloudsql -instances=${INSTANCES}
ygotthilf /
Last active Oct 25, 2021
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out
cat jwtRS256.key
ebidel / polymer-perf-bookmarklet.js
Last active May 1, 2021
Polymer performance numbers bookmarklet
View polymer-perf-bookmarklet.js
javascript:(function(){(function printStats(){var;firstPaint=loadTimes.firstPaintTime*1000;firstPaintTime=firstPaint-(loadTimes.startLoadTime*1000);'First paint took',firstPaintTime,'ms');'Load took',performance.timing.loadEventStart-performance.timing.navigationStart,'ms');var instances=0;if(parseFloat(Polymer.version)<1){instances=[]'html /deep/ *')).filter(function(el){return el.localName.indexOf('-')!=-1||el.getAttribute('is');}).length;}else{instances=Polymer.telemetry.instanceCount;}'Custom element instances:',instances);var reflectCount=0;if(Polymer.telemetry){'=== Properties set to reflectToAttribute ===');Polymer.telemetry.registrations.forEach(function(el){for(var prop in{if([prop].reflectToAttribute){console.log('.'+prop);reflectCount++;}}});}else{'=== Properties set to reflect ===');Polymer.elements.forEach(function(el){for(var
Scarygami / with-debounce
Last active Dec 8, 2017
Polymer debounce sample
View with-debounce
is: 'with-debounce',
properties: {
property1: {
type: String,
observer: '_doSomething'
property2: {
type: String,
observer: '_doSomething'
Couto / package.json
Last active Jun 21, 2021
Test case for file uploads with Hapi.js. Currently failing when same request is made with a simple JSON.
View package.json
"name": "file-upload",
"version": "1.0.0",
"description": "File Upload test case",
"main": "server.js",
"dependencies": {
"hapi": "^8.0.0-rc8",
"joi": "^5.0.2"
"devDependencies": {
thomasvamos /
Created Oct 19, 2013
Python code snippet to plot a greyscale confusion matrix. Its tailored to a project I did, but you get the idea.
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
import random
def main():
true_labels = [random.randint(1, 10) for i in range(100)]
predicted_labels = [random.randint(1, 10) for i in range(100)]
plot = getConfusionMatrixPlot(true_labels, predicted_labels)
plentz / nginx.conf
Last active Oct 24, 2021
Best nginx configuration for improved security(and performance). Complete blog post here
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048