Skip to content

Instantly share code, notes, and snippets.

View priyanshujain's full-sized avatar
🛠️
Always Building

Priyanshu Jain priyanshujain

🛠️
Always Building
View GitHub Profile
@joshbirk
joshbirk / samplerest.js
Created February 3, 2012 19:57
Sample of using passport w/ mult strategies
var fs = require("fs")
var ssl_options = {
key: fs.readFileSync('privatekey.pem'),
cert: fs.readFileSync('certificate.pem')
};
var port = process.env.PORT || 3000;
var express = require('express');
var ejs = require('ejs');
var passport = require('passport')
@p3drosola
p3drosola / validateXML.js
Created April 5, 2012 09:33
Javascript XML validation
function validateXML(txt)
{
// code for IE
if (window.ActiveXObject)
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.loadXML(document.all(txt).value);
if(xmlDoc.parseError.errorCode!=0)
@harperreed
harperreed / peter-thiels-cs183-startup-class-01-notes-essay.md
Created July 29, 2012 21:20
Notes Essays—Peter Thiel’s CS183: Startup—Stanford, Spring 2012

Here is an essay version of my class notes from Class 1 of CS183: Startup. Errors and omissions are my own. Credit for good stuff is Peter’s entirely.

CS183: Startup—Notes Essay—The Challenge of the Future

Purpose and Preamble

@manishtpatel
manishtpatel / main.go
Last active October 18, 2023 03:12
GoLang Encrypt string to base64 and vice versa using AES encryption.
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@kiasaki
kiasaki / readme.md
Last active June 7, 2024 14:57
ubuntu: vboxdrv module signing for secureboot to load it

Since kernel version 4.4.0-20, it was enforced that unsigned kernel modules will not be allowed to run with Secure Boot enabled. Because you want to keep Secure Boot, then the next logical step is to sign those modules.

So let's try it.

Create signing keys

openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=Descriptive name/"

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@nitinbhojwani
nitinbhojwani / nmonitor.sh
Created March 23, 2017 07:28
Monitor individual process metrics - nmonitor usage and shell script.
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "usage error: sh nmonitor.sh <pid> <time_to_monitor_in_seconds>";exit 1
fi
pid=$1
time=$2
#read -p "Please enter your process Id: " pid
@sirodoht
sirodoht / migrate-django.md
Last active October 10, 2024 05:54
How to migrate Django from SQLite to PostgreSQL

How to migrate Django from SQLite to PostgreSQL

Dump existing data:

python3 manage.py dumpdata > datadump.json

Change settings.py to Postgres backend.

Make sure you can connect on PostgreSQL. Then:

@priyanshujain
priyanshujain / new-timezone.json
Last active December 26, 2017 06:04
List of timezones
[
{
"value": "Dateline Standard Time",
"abbr": "DST",
"offset": -12,
"isdst": false,
"text": "(UTC-12:00) International Date Line West",
"utc": [
"Etc/GMT+12"
]