Skip to content

Instantly share code, notes, and snippets.

View shazron's full-sized avatar
😆

Shazron Abdullah shazron

😆
View GitHub Profile
@machuu
machuu / WSL2_VPN_Workaround_Instructions.md
Last active April 18, 2024 23:13
Workaround for WSL2 network broken on VPN

Overview

Internet connection and DNS routing are broken from WSL2 instances, when some VPNs are active.

The root cause seems to be that WSL2 and the VPN use the same IP address block, and the VPN routing clobbers WSL2's network routing.

This problem is tracked in multiple microsoft/WSL issues including, but not limited to:

@borekb
borekb / synology-shutdown-temperature.md
Last active February 17, 2024 15:13
How to increase the shutdown temperature on Synology NAS

Synology: how to increase shutdown temperature

My Synology DS218+ runs with a single SSD disk that has an operating temperature range of 0–70 °C, which is common for SSDs. Synology, however, has a default shutdown temperature of 61 °C, probably due to HDDs and some lazy programming.

I'm a very light user of NAS – all I want is a network attached storage and silence. My DS218+ has one 2 TB SSD disk in it and I've changed the system fan for a quieter / slower one.

Everything runs fine but about once in a month, I get this notification:

[Synology DS218+]Synology shut down due to disk overheating. >

@yocontra
yocontra / aoe2hd.md
Last active June 9, 2023 18:28
Age of Empires II HD - For Mac OSX
@schmich
schmich / npm-prerelease.md
Last active January 3, 2024 18:19
Publish a prerelease package to NPM
  • Update package.json, set version to a prerelease version, e.g. 2.0.0-rc1, 3.1.5-rc4, ...
  • Run npm pack to create package
  • Run npm publish <package>.tgz --tag next to publish the package under the next tag
  • Run npm install --save package@next to install prerelease package
#!/bin/bash
#
# List Apple Developer Account Team IDs from Provisioning Profiles on your local machine.
#
# Source: https://gist.github.com/shazron/e0dc8fb575fcbac1bdc992631ff23fd3
# License: Apachev2
#
# You could also launch Xcode Organizer directly to the Provisioning Profiles section (to check for validity) by running:
# open ~/Library/MobileDevice/Provisioning\ Profiles/*
#
@brianleroux
brianleroux / wtf-sns-apns.js
Created August 5, 2016 23:00
Send a silent push notification to APNS with AWS SNS.
sns.publish({
TargetArn: device.arn,
MessageStructure: 'json',
Message: JSON.stringify({
default: 'you will never see this muah!',
APNS_SANDBOX: JSON.stringify({
aps: {
'alert': '',
'content-available': 1
},
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@vgeshel
vgeshel / function.js
Last active February 9, 2022 09:19
AWS Lambda function for forwarding SNS notifications to Slack
console.log('Loading function');
const https = require('https');
const url = require('url');
// to get the slack hook url, go into slack admin and create a new "Incoming Webhook" integration
const slack_url = 'https://hooks.slack.com/services/...';
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
slack_req_opts.headers = {'Content-Type': 'application/json'};
@jayproulx
jayproulx / create_hooks.sh
Last active August 29, 2015 14:11
Create all of the hook directories and add a script to identify the hook running when it executes
#!/bin/bash
# run this as a script in your-phonegap-project/hooks
hooks=(after_build after_compile after_docs after_emulate after_platform_add after_platform_rm after_platform_ls after_plugin_add after_plugin_ls after_plugin_rm after_plugin_search after_plugin_install after_prepare after_run after_serve before_build before_compile before_docs before_emulate before_platform_add before_platform_rm before_platform_ls before_plugin_add before_plugin_ls before_plugin_rm before_plugin_search before_plugin_install before_plugin_uninstall before_prepare before_run before_serve pre_package);
for hook in ${hooks[@]}
do
mkdir "${hook}"
script="1_identify_hook.js"
@lucdew
lucdew / json_postgres.js
Last active November 16, 2022 17:49
Example of json document storage in postgresql and querying (with knex.js)
var connectionString = 'postgres://localhost:5432/postgres';
var Promise=require('bluebird');
var knex = require('knex')({
client: 'pg',
connection: {
user: 'postgres',
database: 'postgres',
port: 5432,